I am using sqlite database for iphone application. but its crash on the line while loop when collecting data from the database sometimes.
-(void)GetMethod
{
NSString *query = [[NSString alloc] initWithFormat:@"SELECT * FROM errorlogs"];
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(database, [query UTF8String],-1, &statement, nil) == SQLITE_OK)
{
while (sqlite3_step(statement) == SQLITE_ROW) **
{
char *uid1 = (char *)sqlite3_column_text(statement, 0);
NSString *uid = [NSString stringWithFormat:@"%s",uid1];
}
}
sqlite3_finalize(statement);
}
why am I getting this EXC_BAD_ACCESS during the loop.
Thank.
source
share