相关疑难解决方法(0)

应用程序在数据库创建尝试时崩溃

我使用"SQLite数据库浏览器"创建了一个sql数据库,将其拖放到我的Xcode项目中,并构建了应用程序.它在模拟器上工作得非常好但在iPhone上崩溃,出现此错误:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
 reason: 'Failed to create writable database file with message 'The operation could‚ 
not be completed. (Cocoa error 260.)'.'   
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Creates a writable copy of the bundled default database in the application Documents directory:
    NSLog(@"AppDelegate...Looking for embedded Database file...");
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    // Grab the path to the Documents folder:
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = …
Run Code Online (Sandbox Code Playgroud)

database sqlite iphone

11
推荐指数
1
解决办法
3409
查看次数

标签 统计

database ×1

iphone ×1

sqlite ×1