I try to save a configuration file (is a property-list / NSDictionary) to the local application's documents folder.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"perf.plist"];
[self.partsConfigs writeToFile:path atomically:YES]; // partsConfigs is an NSDictionary
NSURL *url = [NSURL fileURLWithPath:path];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObjects:url, nil] applicationActivities:nil];
activityViewController.popoverPresentationController.sourceView = self.view;
[self presentViewController:activityViewController animated:YES completion:nil];
I see the popover activity view to select destination, however I don't see the local application's documents folder.
And if I click to the option "Saves to files" I get this error (however the file corresponding to the passed url still exists)
[ShareSheet] cancelled request - error: The operation couldn’t be completed. Invalid argument
I also would like to be able for the user to select/change the file name
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"perf.plist"];
[self.partsConfigs writeToFile:path atomically:YES]; // partsConfigs is an NSDictionary
NSURL *url = [NSURL fileURLWithPath:path];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObjects:url, nil] applicationActivities:nil];
activityViewController.popoverPresentationController.sourceView = self.view;
[self presentViewController:activityViewController animated:YES completion:nil];
I see the popover activity view to select destination, however I don't see the local application's documents folder.
And if I click to the option "Saves to files" I get this error (however the file corresponding to the passed url still exists)
[ShareSheet] cancelled request - error: The operation couldn’t be completed. Invalid argument
I also would like to be able for the user to select/change the file name