How to copy a file from the Main Bundle into the Documents Directory in iOS

You can do this either by using paths or NSURLs. Apple recommends using NSURLs, so here’s how it works.

In this example we’re copying a file called “Amy.png” which exists in the app’s main bundle.

// file URL in our bundle
NSURL *fileFromBundle = [[NSBundle mainBundle]URLForResource:@"Amy" withExtension:@"png"];
    
// Destination URL
NSURL *destinationURL = [[self applicationDocumentsDirectory]URLByAppendingPathComponent:@"Amy.png"];
    
// copy it over
[[NSFileManager defaultManager]copyItemAtURL:fileFromBundle toURL:destinationURL error:nil];