Closed ispebo closed 9 years ago
same here with ios target (haven't tried android yet)
[UIActivityViewController popoverPresentationController]: unrecognized selector sent to instance 0x15ea1cf0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIActivityViewController popoverPresentationController]: unrecognized selector sent to instance 0x15ea1cf0'
You can fix this crash adding a if condition when acceding to popoverPresentationController property in Share.mm file. That property just appeared in iOS8, so it will crash with an early version.
This's working fine: if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")){ // Required for iPad activityVC.popoverPresentationController.sourceView = [[UIApplication sharedApplication] keyWindow]; // Remove arrow from action sheet. [activityVC.popoverPresentationController setPermittedArrowDirections:0]; // Set action sheet to middle of view. activityVC.popoverPresentationController.sourceRect = [[UIApplication sharedApplication] keyWindow].frame; }
With this define:
Would someone mind testing and doing a pull with this change?
Hi, I can test this on iOS 8 device... but not on lower versions :( If someone can confirm that this works fine on iOS 7 and lower, I'll commit the change :)
I think these calls are why this extension does not build on our build server:
Error: ./ios/Share.mm:22:20: error: property 'popoverPresentationController' not found on object of type 'UIActivityViewController *'
[14:05:55][Step 1/1] activityVC.popoverPresentationController.sourceView = [[UIApplication sharedApplication] keyWindow];
[14:05:55][Step 1/1] ^
[14:05:55][Step 1/1] ./ios/Share.mm:25:21: error: property 'popoverPresentationController' not found on object of type 'UIActivityViewController *'
[14:05:55][Step 1/1] [activityVC.popoverPresentationController setPermittedArrowDirections:0];
[14:05:55][Step 1/1] ^
[14:05:55][Step 1/1] ./ios/Share.mm:28:20: error: property 'popoverPresentationController' not found on object of type 'UIActivityViewController *'
[14:05:55][Step 1/1] activityVC.popoverPresentationController.sourceRect = [[UIApplication sharedApplication] keyWindow].frame;
[14:05:55][Step 1/1] ^
Is the build server updated? maybe it doesn't have the last SDK from Apple and it doesn't recognize that property (I don't really know how it build, but I think that maybe it's failing because of that).
I can do a PR, but I have a big mess with tons of repos... so it could take a while :(
I think it may be safer to surround the code with respondsToSelector like this:
if ([activityVC respondsToSelector:@selector(popoverPresentationController)]) {
activityVC.popoverPresentationController.sourceView = [[UIApplication sharedApplication] keyWindow];
[activityVC.popoverPresentationController setPermittedArrowDirections:0]; // Remove arrow from action sheet.
activityVC.popoverPresentationController.sourceRect = [[UIApplication sharedApplication] keyWindow].frame; // Set action sheet to middle of view.
}
Yep, that's more in the Obj-C way :)
Great, I'll be pushing an update in few minutes. I'm testing now :)
Done! An update has been published on haxelib :) Thanks guys!
Also, I've deprecated the old "openfl-share" library from haxelib.
Hello Just try for the first time "extension-share". I tried for two targets: Android and iOS. Everything seems to work correctly for Android Target (however I can not post images) The application crash when I try to share to iOS Target. Here is the error: *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [UIActivityViewController popoverPresentationController]: unrecognized selector sent to instance 0x16508e70'