Supporting iOS modal share action sheet (AirDrop, Print, Add to Home Screen, Add Bookmark, Add to Reading List, etc.)

Any eta on the iPad fix? We can’t use this until it works across platforms correctly.

Regarding Instagram, WeChat and others:

The activity functionality built into iOS — and the functionality of our Activity plugin — is partially based on what the recipient app provides (i.e. Instagram). If you open up Apple’s “Activity” panel, i.e. by opening the “Share” dialog from within Apple’s own “Photos” app and you click “More…”, you’ll notice that certain apps appear in the menu, while others do not. Instagram does not. 

Instagram and other apps can choose to implement the iOS 8 sharing extension if they want.  There is a way for an app to force these, but it requires native code that can’t be easily implemented in a generic way through our plugin.

In summary, if you need to add other services according to your desires, you can accomplish it via Corona Enterprise. Here is an article which discusses the process:
http://www.codingexplorer.com/add-sharing-to-your-app-via-uiactivityviewcontroller/

The UIAcitivtyViewController plugin has been updated to support iPads.  The documentation may be a few more hours before it updates, but you can use the media.selectPhoto() docs for the basics.   Here is some code that I’ve been using:

        native.showPopup( popupName,         {             items = itemsByDataType,             -- excludedActivities = { "UIActivityTypeCopyToPasteboard", },             listener = listener,             origin = button.contentBounds,             permittedArrowDirections={ "up", "down" }         })

where button is the object that I want the sharing panel to originate from.

Rob

Great stuff Rob! I’ll try that right away - that was just a plugin update, right? No need to get a new daily build?

Thx

David

Thanks, Rob! It’s good to know iPad support has been added.

Is there a feature request for this on the Feedback site?  This seems close, but if there are others, we can try and combine them.

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5096197-share-to-other-apps-such-as-evernote-line-dropb

Rob

Hi Rob! I think the Feedback item is the same feature request as what we were talking about above – adding support for the standard iOS share action sheet.

In terms of other sharing-related requests, the obvious one to include is Facebook sharing on Android via the native.showPopup() social plugin for URLs and images (but not pre-filled-out-text, given FB’s policy on that). You and I discussed this late last year here:

http://forums.coronalabs.com/topic/52755-can-corona-enable-limited-facebook-sharing-on-android-via-nativeshowpopup/

It’s kind of you to help out with this, and you should know that we appreciate it!

We need the UIActivityViewController as a plugin. With this we get both sharing for other apps, airdrop, print, copy and more.

Rob already showed how easy it is to implement with swift. http://coronalabs.com/blog/2014/12/30/tutorial-implementing-sendto-with-coronacards-and-swift/ so please make it top priority.

how exactly (step by step) do I use this plug in. It just crashes anytime I download the zip file and run it on the simulator

You can’t run it in the Corona Simulator this is an enterprise plugin.

You need to open the SharePlugin/ios/App.xcodeproj file in Xcode and build the example from there.

Thanks for voting for this.   It’s probably going to need more votes to get implemented, even though this seems to be somewhat low hanging fruit.  While I implemented it pretty easily with Corona Cards, it get it in the existing native.showPopup() API, which is the logical place for it, will take more work and thought.

Rob

Um, adding this requires only 10 lines of Objective C code on Corona’s part. That’s not “low hanging fruit” – it’s fruit that’s been grown, picked, cleaned, transported, packaged, and delivered to your front door in a gift-wrapped basket topped by a shiny label saying “Open me now, I’m really tasty!” Here are the 10 lines you need to add:

- (void)shareText:(NSString \*)text andImage:(UIImage \*)image andUrl:(NSURL \*)url { NSMutableArray \*sharingItems = [NSMutableArray new]; if (text) { [sharingItems addObject:text]; } if (image) { [sharingItems addObject:image]; } if (url) { [sharingItems addObject:url]; } UIActivityViewController \*activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil]; [self presentViewController:activityController animated:YES completion:nil]; }

And here’s a reasonable way to add the functionality to native.showPopup via a new service you could call “actionSheet.” (Heck, I’ll even volunteer to update your API pages for you gratis!)

native.showPopup( popupName, { service = "actionSheet", message = "Your Lovely Delightful Wonderful Message Goes Here", listener = listener, image = { { filename = "Icon.png", baseDir = system.ResourceDirectory }, }, url = { "http://trivial-to-add.com", } })

You’re welcome. :slight_smile:

@rob

well you can add up these votes:

printing:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3817667-support-for-printing-directly-from-an-app-to-a-wir

 

mms with image:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3878055-mms-feature-to-send-image-attachments-to-cell-phon

 

sharing:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5096197-share-to-other-apps-such-as-evernote-line-dropb

 

pasteboard:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/3712751-pasteboard-support

 

app interactions:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/6486887-corona-sdk-needs-to-add-an-api-for-app-interaction

 

plus all the requests you will probably get for airdrop pretty soon.

 

That is a lot of votes for low hanging (or delivered) fruit!!

Excellent point. You can also add this one from a year ago, which notes Corona cannot “share to other apps, such as Evernote, etc.” and asks for a fix:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5433041-a-rewrite-for-webview-module

So if I’m doing my math properly that’s 39+71+14+22+24+43, which puts the total votes at 213.

That makes this by far the #1 requested iOS feature (the second is iCloud integration, with a mere 188 votes.) Not bad for a fix that takes 10 lines of code!

That basket of low-hanging fruit has now been brought inside from the front door to the dining room table, has been chopped up into a delicious salad, and is being served to you in a bowl with a dollop of crème fraîche on the top.

Thank you guys for adding this plugin! One question though, how do I put a subject in the email section? When I add strings its only adding it to the body.

You can’t.

Folks: There’s been some discussion of adding these 10 lines of Objective C on this forum thread:

http://forums.coronalabs.com/topic/28785-nativeshowpopuptwitter-not-working-in-app-example-project/#entry280869

As far as I can tell, Walter’s response was, basically, no.

It would be nice to have a response from Rob on this thread – it’s been two weeks of radio silence – since Walter said it was off-topic elsewhere.

Hi @corona273,

To clarify, the answer isn’t simply “no”, but we’d like to guage the demand for this via the expected venue (feedback). The other thread was about the Twitter popup, and so that thread should be kept on-topic.

Currently, we are consolidating and combining various feedback requests which are related, and if we gather these into one basket with a large amount of votes, then it will be treated with higher priority.

Thanks,

Brent

Hi all,

on my iPad with iOS the plugin still crashes. Console says:

<Error>: *** Terminating app due to uncaught exception ‘NSGenericException’, reason: ‘-[UIPopoverController dealloc] reached while popover is still visible.’

Any ideas?

Thanks

Peter

Please read:

https://coronalabs.com/blog/2015/03/17/tutorial-utilizing-the-activity-popup-plugin-ios/

Rob