-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting exception while sharing on iOS8 #5
Comments
After some google research, I fixed my issue by modifiying ShareBunch.m and rebuilding it. - (void)shareText:(NSString *)text {
NSArray *postItems = @[text];
UIActivityViewController *activityVC = [[UIActivityViewController alloc]
initWithActivityItems:postItems
applicationActivities:nil];
if ([activityVC respondsToSelector:@selector(popoverPresentationController)]) {
activityVC.popoverPresentationController.sourceView = [[UIApplication sharedApplication] keyWindow].rootViewController.view;
}
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:activityVC animated:YES completion:nil];
} |
@Day366, that's really fine. Can you create a PR for the changes? |
Sorry for potentially obvious question, but where exactly is that ShareBunch.m you're talking about? I'm not seeing it anywhere in this repository. Edit: Ah, found it in the iOS source repository. But I'm not sure how can I actually get that fix into a Unity project, seeing that it has no use for .m files. I guess I somehow need to create a new version of ShareBunch.a out of that fixed .m file? How is that done? |
it's in iOS part: |
Sorry, but can you elaborate on how this fix is implemented? It's not very clear to me how exactly iOS plugins for Unity are working sometimes (code seems organized very differently between official plugin tutorial using DllImport and your plugins) so I might be misunderstanding how it's done. I have changed the shareText method posted above in the ShareBunch.m from the native repo, but what then? Do I remove libShareBunch files from Unity project Assets/Plugins/iOS folder and add ShareBunch.h & fixed ShareBunch.m there? |
Hi,
I have no trouble on android and iOS7 but I am getting the exception below on iOS8.
If you search the exception you will see similar problems on iOS8 in different projects.
2015-02-27 23:42:34.560 filltwo[185:6131] Uncaught exception: NSGenericException: UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x1a588560>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.
(
0 CoreFoundation 0x29fcb4b7 + 150
1 libobjc.A.dylib 0x37b93c8b objc_exception_throw + 38
2 UIKit 0x2db2b42f + 2698
3 UIKit 0x2d759633 + 1194
4 UIKit 0x2d75830b + 150
5 UIKit 0x2d506235 + 308
6 UIKit 0x2d48204b + 458
7 CoreFoundation 0x29f91d95 + 20
8 CoreFoundation 0x29f8f453 + 278
9 CoreFoundation 0x29f8f85b + 914
10 CoreFoundation 0x29edd3c1 CFRunLoopRunSpecific + 476
11 CoreFoundation 0x29edd1d3 CFRunLoopRunInMode + 106
12 GraphicsServices 0x312810a9 GSEventRunModal + 136
13 UIKit 0x2d4eb7b1 UIApplicationMain + 1440
14 filltwo 0x000af5e4 main + 312
15 filltwo 0x000af4a8 start + 40
)
2015-02-27 23:42:34.560 filltwo[185:6131] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x1a588560>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
*** First throw call stack:
(0x29fcb49f 0x37b93c8b 0x2db2b42f 0x2d759633 0x2d75830b 0x2d506235 0x2d48204b 0x29f91d95 0x29f8f453 0x29f8f85b 0x29edd3c1 0x29edd1d3 0x312810a9 0x2d4eb7b1 0xaf5e4 0xaf4a8)
libc++abi.dylib: terminating with uncaught exception of type NSException
The text was updated successfully, but these errors were encountered: