iPhone: Copy a file from resources to documents | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

iPhone: Copy a file from resources to documents

Friday

iPhone SDK: How to copy a file from resources to documents Directory?:
                                                        You can copy a file or database from resources to documents directory by using the following code.
Code:

NSFileManager *fileMgr= [[NSFileManager alloc] init];
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"reporter.sqlite3" ofType:nil];
    NSError *error;
    if(![fileMgr copyItemAtPath:filePath toPath:[NSString stringWithFormat:@"%@/Documents/reporter.sqlite3", NSHomeDirectory()] error:&error]) {
         //Exception Hndling
         NSLog(@"Error : %@", [error description]);

    }
    [fileMgr release];

0 comments:

Post a Comment

Share your thoughts here...

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets