Я использую общий доступ к файлам iTunes в своем приложении. Мое приложение предоставляет несколько файлов, которые могут быть переданы через общий доступ к файлам iTunes. Однако на данный момент пользователь может удалять, переименовывать (в основном, делать что-либо с тем, что находится внутри моего приложения, которое является общим)
Я хочу знать, как сделать так, чтобы у пользователя не было этих привилегий, я хочу, чтобы все, что они могли сделать, это передать файл и все.
Вот код, любая помощь очень ценится
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSArray *names = [NSArray arrayWithObjects: @"test.gif", @"test1.gif", nil];
for (NSString *fileName in names)
{
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 = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}