how to solve run time error 'Failed to create writable database file with message 'The operation couldn’t be completed. (Cocoa error 260.)'.'?

Posted by user1432045 on Stack Overflow See other posts from Stack Overflow or by user1432045
Published on 2012-06-21T08:50:22Z Indexed on 2012/06/21 9:16 UTC
Read the original article Hit count: 525

Filed under:

I am beginner of iPhone I have created database but that give run time error of Failed to create writable database file with message 'The operation couldn’t be completed

my code is

-(void)createdatabase
{
    NSFileManager *fileManager=[NSFileManager defaultManager];
    NSError *error;
    NSString *dbPath=[self getDBPath];
    BOOL success=[fileManager fileExistsAtPath:dbPath];
    if(!success)
    {
        NSString *defaultDBPath=[[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"SQL.sqlite"];
        success=[fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&error];
        if(!success)
        {
                NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);  
        }

    }
}

give any suggestion and source code which is apply in my code

© Stack Overflow or respective owner

Related posts about objective-c