COPYING BUNDLED RESOURCES
In the previous section, you learned how to embed a property list file into your application and then programmatically recreate the property list and save it in the Documents folder during runtime. While that example showed the various ways to manipulate a property list, in general it is much easier to simply copy the resource (such as the property list) into the Documents folder directly.
All resources embedded within your application (commonly known as bundled resources) are read-only. In order to make changes to them, you need to copy them into the application's folders, such as the Documents or tmp folders. You can do so by copying the resource when the application starts. The ideal location to perform this is in the application delegate. Using the preceding example, you could define the following copyFileInBundleToDocumentsFolder:withExtension: method in the FilesHandlingAppDelegate.m file:
#import “FilesHandlingAppDelegate.h” #import “FilesHandlingViewController.h” @implementation FilesHandlingAppDelegate @synthesize window = _window; @synthesize viewController = _viewController; - (void) copyFileInBundleToDocumentsFolder:(NSString *) fileName withExtension:(NSString *) ext { //--get the path of the Documents folder-- NSArray *paths = NSSearchPathForDirectorieslnDomains( NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; //--get the path to the file you want to copy in the Documents folder-- NSString ...