I created a new project (with the two required options in Info.plist - UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace to YES), and using a single view controller.
The second popover also goes down, as if it could't handle the item (plist file url), with error :
Failed to determine whether URL /Users/.../Library/Developer/CoreSimulator/Devices/.../data/Containers/Data/Application/.../Documents/perf.plist (n) is managed by a file provider
On iOS12.4 iPad target (simulator), and XCode 10.3.
UPDATE : it works on a real device (iPad mini 2) (the second popover stays, I can select On my iPad, and the application directory as target. However can't rename the file).
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *saveBtn;
@property (strong, nonatomic) NSDictionary *partsConfigs;
@end
@implementation ViewController
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
(IBAction)saveFile:(id)sender {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"perf.plist"];
NSDictionary *firstPartConfig = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Analog 4", @"PADS", nil] forKeys:[NSArray arrayWithObjects:@"name", @"category", nil]];
self.partsConfigs = [NSDictionary dictionaryWithObject:firstPartConfig forKey:@"1"];
[self.partsConfigs writeToFile:path atomically:YES];
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];
}
@end