Crash with uncaught exception in iPad from Sqlite Statment
Hi,
I am getting problem over iPad with sqlite communication of data. Data storing, Its running good for 5 minutes then its get two type of errors.
Like,
1.Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamedundle:] was unable to load a nib named "SlideImageDisplayViewController.
2.Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to open database with message 'unable to open database file.
When i try to solve one another 1.error next time 2.error will come.
I hope some one help me.
I am attached the insertion part of my code. where i get crash.
@try{
if(insertStatment==nil){
char *sqlName = "insert into history(title,subtitle) values(?,?)";
sqlite3_stmt *insertStatment=nil;
// I am getting crash after reach the if condition
if (sqlite3_prepare_v2(database, sqlName, -1, &insertStatment, NULL) != SQLITE_OK)
{
NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));
}
sqlite3_bind_text(insertStatment, 1, [title UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(insertStatment, 2, [subtitle UTF8String], -1, SQLITE_TRANSIENT);
int success11 = sqlite3_step(insertStatment);
printf("%d",success11);
sqlite3_reset(insertStatment);
if (success11 == SQLITE_ERROR)
{
NSAssert1(0, @"Error: failed to insert into the database with message '%s'.", sqlite3_errmsg(database));
}
else
{
}
}
if(insertStatment)sqlite3_finalize(insertStatment) ;
sqlite3_close(database);
NSLog(@"row inserted");
}
@catch (NSException *ex) {
@throw ex;
}
|