Awaria aplikacji podczas próby utworzenia bazy danych

Stworzyłem bazę danych sql przy użyciu „Przeglądarki bazy danych SQLite”, przeciągnąłem i upuściłem ją do mojego projektu Xcode i zbudowałem aplikację. Działa doskonale na symulatorze, ale zawiesza się na iPhonie, z tym błędem:

<code>*** 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.)'.'   
</code>

Oto mój kod:

<code>- (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 = [paths objectAtIndex:0];
    NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"users.sql"];

    success = [fileManager fileExistsAtPath:writableDBPath];
    if (success) {
        NSLog(@"Database File Exists in Documents folder!");
        NSLog(@"Its path is: %@", writableDBPath);
        return YES;
    }
    else {
    // But if the writable database does not exist, copy the default to the appropriate location.
    NSLog(@"!!NO Database File Exists in Documents folder!");
    NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"users.sql"];
    success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
    if (!success) {
        NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
    }
    else 
        NSLog(@"WROTE THE DATABASE FILE!!!");
}

return YES;
}
</code>

Ponownie działa to na symulatorze, ale nie na iPhone. (To nie może mieć nic wspólnego z plikiem mającym rozszerzenie „.sql” w przeciwieństwie do rozszerzenia „.sqlite”, czyż nie? Bo to rozszerzenia, które „Przeglądarka bazy danych SQLite” udostępnia pliki, które tworzy) .)

questionAnswers(3)

yourAnswerToTheQuestion