NSString *docsDir;
NSArray *dirPaths;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
databasePath = [[NSBundle mainBundle] pathForResource:@"etkYeni2" ofType:@"sqlite"];
const char *dbpath = [databasePath UTF8String];
sqlite3_stmt *statement;
if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK){
NSLog(@"icerdeyim");
NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO etk (etkTip) VALUES ('%@')",yeniEkleLabel.text];
const char *query_stmt = [insertSQL UTF8String];
sqlite3_prepare_v2(contactDB, query_stmt, -1, &statement, NULL);
if (sqlite3_step(statement) == SQLITE_DONE)
{
NSLog(@"OK INSERTED");
} else {
NSLog(@"NOT INSERTED !!");
}
sqlite3_finalize(statement);
sqlite3_close(contactDB);
}
Here is my part of the code which I getting a string from the textbox and inserted it to the sqlite database. I created the database from the firefox extention sqlite manager and added it to the app. It is running as I expected in simulator and ipod touch how I wanted (inserts elements and I can see them when I used SELECT query ), but it is not inserts an element on iphone . My ipod touch is on iOS 5 and iphone is on iOS 6. Is it because of the version of iOS or iphone and ipod touch is pretends differently to the sqlite or what ? I read most of the answers of this problem and still don't get the solution. Could someone can help me in this situation ? Thanks ..