I have a UIActivity subclass that generates data asynchronously. So as an example say we have a "Generate Spreadsheet" activity. In the implementation of the activity:
-(UIViewController*)activityViewController
{
if (_backingViewController == nil)
{
_backingViewController = [[ActivityWithProgressUIViewController alloc]init];
[self performActivity]; // <-- start the activity... always required to manually start the activity when providing a view controller.
}
return _backingViewController;
}// return non-nil to have view controller presented modally. call activityDidFinish at end. default returns nil
Then in -performActivity override...do the work...
-(void)performActivity
{
NSLog(@"start performing...pretend we are creating a spreadsheet..");
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self activityDidFinish:YES];
NSLog(@"Finished performing.");
});
}
And that works on iOS. On Mac Catalyst the system never dismisses the view controller returned by UIActivity subclass. Also the UIActivityViewController's completionWithItemsHandler is called immediately after the custom activity is invoked, the system doesn't wait for the custom activity to call -activityDidFinish: The system just leaves the abandoned view controller returned by the custom activity on screen.
Works fine on iOS. Easy to reproduce in a sample project.