我在此代碼中遇到問題:它在iPhone和iPad Mini上運行正常,但它在大iPad上提供了錯誤消息。有什麼理由嗎?sqlite3_prepare_v2在iPhone和iPad迷你設備上返回OK,但在普通iPad設備上出現錯誤
代碼:從LLDB
- (sqlite3_stmt *)executeQuery:(char *)aQuery {
NSString *dbPath = [[NSUserDefaults standardUserDefaults] objectForKey:kDBPath];
sqlite3_stmt *statement = NULL;
sqlite3 *database;
if (sqlite3_open((char *)[dbPath UTF8String], &database) == SQLITE_OK) {
if (sqlite3_prepare_v2(database, aQuery, -1, &statement, NULL) != SQLITE_OK) {
//Here is the point: on iPad Mini and iPhone it works fine, but on the normal iPad it can't execute this query
NSLog(@"Error on SQL - (sqlite3_stmt *)executeWithReturn:(char *)aQuery");
statement = NULL;
}
} else {
NSLog(@"Error on Open database");
}
return statement;
}
打印:
(lldb) print (BOOL)[[NSFileManager defaultManager] isWritableFileAtPath:dbPath]
(BOOL) $0 = YES
(lldb) print (char *)aQuery
(char *) $1 = 0x1f0a1000 "select CodAplicacao, CodLocalidade, Nome, Desc, DataCriacao, Editando from Aplicacao_en"
任何想法?
問候!
編輯:
它越來越錯誤 「數據庫磁盤映像格式有誤」。我無法在互聯網上找到如何解決這個問題。
請參閱修改後的答案「數據庫磁盤映像格式不正確」。 – Rob 2013-04-12 00:29:04