HaxeExtension / extension-share

Share Extension for OpenFL
Other
43 stars 12 forks source link

iOS 7 crash #2

Closed Waynetron closed 9 years ago

Waynetron commented 9 years ago

Calling Share.share on iOS 7 causes a crash.

fbricker commented 9 years ago

Hi, can you provide more information?

How are you calling the init and the share methods? When does it crash? Does it happens on iPad or iPhone? Is this happening on a real device or a simulator?

kitchsGithubName commented 9 years ago

I can confirm this, perhaps with a little more elaboration. Seeing the same thing (iPhone - iOS 7.1.1)

My initial call was significantly more complex, however I was able to duplicate it with this:

Share.init(Share.TWITTER); Share.share("IM ON THE TWITTERZ!");

Xcode gives me the following: screen shot 2015-02-24 at 12 05 42 am

Also, on a side note, on an iPad ( iOS 8.1.2) The same call give me : screen shot 2015-02-24 at 12 13 19 am

It does not crash, but gives the generic "What do you want to share to" dialog, including twitter/message/email, etc. Supplying a defaultURL and defaultSubject, that just shows the "invalidationHandler calle" message, without all the other stuff... Plus the generic dialog.

kitchsGithubName commented 9 years ago

Finally got some time to look into this again. I wrapped all the new iPad code in an if statement, and it now appears to work for me on iOS 7 on an iPhone, and iOS 8 on an iPad.

But an objective-c programmer I am not... I am an objective-c hack... so I'll throw that disclaimer in there.

if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
{
    // 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;

    }

Thank you for the extension!

*edit - formatting

pozirk commented 9 years ago

Just caught the same exception on iOS 7, had no such problems with iOS 8. Would be good to update the extension.

fbricker commented 9 years ago

Hi, this has been just solved with version 1.2.2 of the extension. Sorry for being disconnected so long.

By the way, you should install and use "extension-share" now (the old openfl-share is now deprecated).

pozirk commented 9 years ago

Nice, thank you!