更新应用后,sqlite 数据库出现问题。应用程序崩溃。这是我的日志,但我不确定有什么问题:
Stack: (
"0 MyApp 0x00085bdb MyApp + 543707",
"1 MyApp 0x0008633d MyApp + 545597",
"2 libsystem_c.dylib 0x3af73e8b _sigtramp + 34",
"3 libsqlite3.dylib 0x3792c447 sqlite3_log + 4986",
"4 libsqlite3.dylib 0x3792c447 sqlite3_log + 4986",
"5 libsqlite3.dylib 0x3791d1cb sqlite3_exec + 11954",
"6 libsqlite3.dylib 0x3791b989 sqlite3_exec + 5744",
"7 libsqlite3.dylib 0x3791b119 sqlite3_exec + 3584",
"8 libsqlite3.dylib 0x3791ac17 sqlite3_exec + 2302",
"9 libsqlite3.dylib 0x3791a977 sqlite3_exec + 1630",
"10 libsqlite3.dylib 0x3795195f sqlite3_prepare_v2 + 30",
"11 MyApp 0x00091ca7 MyApp + 593063",
"12 MyApp 0x00094211 MyApp + 602641",
"13 MyApp 0x000c09d9 MyApp + 784857",
"14 UIKit 0x3a044545 <redacted> + 412",
"15 UIKit 0x3a02930b <redacted> + 1310",
"16 UIKit 0x3a0407c7 <redacted> + 206",
"17 UIKit 0x39ffc803 <redacted> + 258",
"18 QuartzCore 0x3bcd0d63 <redacted> + 214",
"19 QuartzCore 0x3bcd0901 <redacted> + 460",
"20 QuartzCore 0x3bcd1835 <redacted> + 16",
"21 QuartzCore 0x3bcd121b <redacted> + 238",
"22 QuartzCore 0x3bcd1029 <redacted> + 316",
"23 UIKit 0x3a1cc1e1 <redacted> + 112",
"24 UIKit 0x3a07c627 <redacted> + 34",
"25 CoreFoundation 0x342be6cd <redacted> + 20",
"26 CoreFoundation 0x342bc9c1 <redacted> + 276",
"27 CoreFoundation 0x342bcc91 <redacted> + 608",
"28 CoreFoundation 0x3422febd CFRunLoopRunSpecific + 356",
"29 CoreFoundation 0x3422fd49 CFRunLoopRunInMode + 104",
"30 GraphicsServices 0x377742eb GSEventRunModal + 74",
"31 UIKit 0x3a04d2f9 UIApplicationMain + 1120",
"32 MyApp 0x000036e3 MyApp + 9955",
"33 MyApp 0x0000369c MyApp + 9884"
)
第 11 行显示我的函数中的函数 sqlite3_prepare_v2 存在问题:
- (BOOL) checkIfTableExist:(NSString *) tableName
{
BOOL exist = NO;
sqlite3_stmt *stmt;
NSString *sql = [[NSString alloc] initWithFormat:@"SELECT name FROM sqlite_master WHERE type = 'table' AND name = '%@'", tableName];
if (sqlite3_prepare_v2(database, [sql UTF8String], -1, &stmt, NULL) == SQLITE_OK) {
if (sqlite3_step(stmt) == SQLITE_ROW)
exist = YES;
sqlite3_finalize(stmt);
}
[sql release];
return exist;
}
可能是更新应用程序后数据库文件损坏了还是什么?