我目前正在爲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