I'm currently working on a game for the iphone, where images are loaded from the internet and then stored in the local database so they do not have to be loaded again. This has always worked fine. Recently I created a new adhoc distribution for the testing group (the first time I created the distribution using SDK 3.1.2) and now everybody that has upgraded their iphone to 3.1.2 are no longer able to write to the database anymore, and thus have to load the images everytime from the internet. People with an iphone version lower than 3.1.2 have no problems and previously build versions (with SDK 3.1 or lower) have no problems on iphones with 3.1.2. The updates I made to the game had nothing to do with the datamanager in the game. Another strange thing is that I do not find any messages in the console using the following code:
- (void) saveImage:(NSString *)imagePath withData:(NSData *)imageData {
if (insert_image_statement == nil){
const char *sql2 = "INSERT INTO image (imagePath, imageData) VALUES (?, ?);";
if (sqlite3_prepare_v2(database, sql2, -1, &insert_image_statement, NULL) != SQLITE_OK) {
NSLog(@"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));
}
}
sqlite3_bind_text(insert_image_statement, 1, [imagePath UTF8String], -1, NULL);
sqlite3_bind_blob(insert_image_statement, 2, [imageData bytes], [imageData length], NULL);
int success = sqlite3_step(insert_image_statement);
if (success == SQLITE_ERROR){
NSLog(@"Error: failed to insert statement with message '%s'.", sqlite3_errmsg(database));
}
sqlite3_reset(insert_image_statement);
}
So the sqlite3 does not throw an error which could point me towards the solution of this problem. Does anybody know why with SDK 3.1.2 I do not seem to have the permission to write the data to the database?