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

I’m grateful for Corona’s very nice text support in a recent daily build, but thought I’d push my luck and ask if it would be possible to support the standard iOS share action sheet.

Yes, it’s true that we can share via Facebook/Twitter/email/SMS. But the iOS modal share action sheet is far more capable. It includes AirDrop, Add to Home Screen, Add Bookmark, Add to Reading List, Assign to Contact, Print, Slideshow, Flickr/Snapchat (if installed), etc.

The good folks at StackOverflow call it a “trivial” 10 lines of code in Objective C, and even show you how:

“The UIActivityViewController stated in the other answer makes this trivial. All you have to do is specify the text/image/URL that you want to share and present the activity view controller modally and iOS will automatically display all applicable sharing services.” http://stackoverflow.com/questions/13498459/how-to-display-the-default-ios-6-share-action-sheet-with-available-share-options

Corona has supported the Android sharing panel since at least 2013 via the social plugin. It would be great to support iOS sharing as well, especially because it’s a trivial addition. Is this possible?

Thanks in advance!

While I’m trying to convince everyone of the merits of this, we have to way this in with everything else we have going on right now and I know getting engineering time on this right now is going to be a hard sale.

What would help is to get people to vote up a feature request for this at http://feedback.coronalabs.com.

Rob

Rob, thanks for your support on this! I expect you have a lot of things in the queue already but perhaps trivial changes – especially when it makes Corona’s sharing-panel support for iOS equivalent to its existing support for Android – could be bumped up a little in the priority queue.

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.

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.

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

I did a native plugin for the modal share action with image, text and url (for Airdrop, MMS, Mail, Air print, Twitter, Facebook etc.) + Instagram sharing as a custom activity.

You can find it here: https://github.com/jcbnlsn/CoronaSharePlugin

This is only for Enterprise subscribers.

@CoronaLabs feel free to put it on your plugin server :wink:

Folks: There are now two more threads in the last day or so asking about sharing:

http://forums.coronalabs.com/topic/54267-here-is-how-to-share-a-picture-image-with-instagram-with-corona-sdk-without-enterprise/

"I think instagram/apple decided that the only way to share to instagram is through the native UIDocumentsInteractionController.

Corona doesn’t have that implementet but you should vote it up in the feature requests."

Brent: It’s been two weeks since you said you were consolidating and combining feedback requests, and we’ve known for a while that proper sharing is developers’ most-requested feature. Can you give us any insight into a timeframe, either through your own method or through <ojnab>'s plugin if possible?

Hi all,

We understand and have listened to your requests. We will have our own plugin for this available within the next few days, available to Pro and above. It will mimic the UIActivityController in iOS and should offer whatever Apple offers in that regard.

Best regards,

Brent

Brent: This is excellent news! Thanks very much for listening to us. You’ve made my week!

@Brent 

That sure is a nice decision! Thanks.

Execellent news! How can we share to instagram on android?

<spacewolf>: You may want to check out this discussion of Android sharing, though it’s focused on Corona’s lack of support for Facebook sharing via the social plugin:

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

So the social plugin will allow sharing to instagram if you specify an image in the api call?