虽然我已经链接了 sqlite3 框架并将标题包含在我的应用程序委托文件中,但 Xcode 想要更改:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
if ([MyDatabase database]) sqlite3_close([MyDatabase database]);
}
对此:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
if ([MyDatabase database]) sqlite3_close((__bridge sqlite3 *)([MyDatabase database]));
}
在上面的代码中,database 是对 MyDatabase 实例的单例引用,该实例适用于程序的所有其他方面。