iTunes File Sharing Support
In Lesson 21 you learned to store data within files on the device. These files were created by your application in a restricted environment on the device known as the sandbox. In this lesson you learn to allow your users to modify the contents of one of the directories in your application’s sandbox with iTunes.
This feature is known as iTunes file sharing, and the first thing you need to do to enable it in your app is to add the Application supports iTunes file sharing key to the project’s info.plist file. Set the value of this key to YES, as shown in Figure 24-1.
When you add this key to the info.plist file, iTunes essentially displays the contents of your application’s Documents directory to users when they go to the Apps section in iTunes and scroll to the bottom (Figure 24-2).
In your application, you can enumerate the contents of the Documents directory using the contentsOfDirectoryAtPath:error: method of the NSFileManager class using code similar to the following:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsFolderPath = [paths objectAtIndex:0]; NSError* errVal; NSArray* directoryList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsFolderPath ...