I'm trying to create QML mobile app with sharing option (mail, Twitter...). Everything works fine on iOS emulator, but when I run app on iPad and press the share button the app stops working.
I'm not sure what is wrong.
Here is a code used for show sharing options:
NSMutableArray *sharingItems = [NSMutableArray new];
if (!text.isEmpty()) {
[sharingItems addObject:text.toNSString()];
}
if (url.isValid()) {
[sharingItems addObject:url.toNSURL()];
}
UIViewController *qtController = [[UIApplication sharedApplication].keyWindow rootViewController];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
[qtController presentViewController:activityController animated:YES completion:nil];
I`m getting this error message:
Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x17eba1e0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'