我目前正在为iPhone的游戏工作,图像从互联网加载,然后存储在本地数据库,所以他们不必再次加载。这一直运行良好。 最近我为测试组创建了一个新的adhoc发行版(我第一次使用SDK 3.1.2创建发行版),现在每个将iphone升级到3.1.2的人都不再能够写入数据库了,因此必须每次从互联网加载图像。 iphone版本低于3.1.2的用户没有问题,而以前的版本(用SDK 3.1或更低版本)对于带有3.1.2的iphones没有问题。 我对游戏进行的更新与游戏中的数据管理员无关。另一个奇怪的是,我不使用下面的代码中找到在控制台中的任何消息:sqlite3在iPhone 3.1.2写入权限问题
- (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);
}
所以sqlite3的不放箭,可以点我对这个问题的解决方案的错误。有人知道为什么使用SDK 3.1.2我似乎没有将数据写入数据库的权限?
你看到了什么错误?你的数据库在哪里?你从sqlite3_bind_text和sqlite3_bind_blob得到了什么结果?我可以向你保证,我们仍然在用3.1.2编写blob到我们的数据库,而且我们的SQL比这更复杂。我怀疑你在SQLite中发现了一个错误。 – 2009-11-13 16:59:11
我没有看到任何错误,我注意到的唯一情况是该blob没有写入数据库。数据库位于documentsDirectory中。奇怪的是,它只发生在AdHoc Distribution中,如果我直接在手机上构建应用程序,它不会发生。 – 2009-11-16 08:42:54