Сначала включите Application supports iTunes file sharing
в списке настроек вашего проекта. Он также может быть назван UIFileSharingEnabled
.
Затем для кода сохраните файл в NSDocumentDirectory
примерно так:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Id its a local file in the app use its name. If not, alter for your needs.
NSString *fileName = @"someFile.png";
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:fileName];
if (![fileManager fileExistsAtPath:documentDBFolderPath]) {
NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName];
[fileManager copyItemAtPath:resourceDBFolderPath toPath:documentDBFolderPath error:&error];
}
[self.window makeKeyAndVisible];
return YES;
}
Все взято из iOS Dev Tips - обмен файлами из приложения в iTunes слишком прост