Share text AND media with WhatApp Share Extension - ios

I'm using a UIActivityViewController to enable the user to share photos and videos created with my app. I attached two UIActivityItemProviders to it: one for the media and one for a default text to use ("Created with...").
This works well for all share extensions I tested—except for WhatsApp. WhatsApp only shows the text in the message dialog—no photo or video. When I leave the text blank, however, it will show the media file.
Is there any way I can share a photo or video with a default text/caption via WhatsApp?

I'm facing the same challenge. I implemented my own extension using https://github.com/sascha/SSCWhatsAppActivity. The downside is that you'll get two WhatsApp entries when sharing. WhatsApp's own one, and the custom one. I tried excluding WhatsApp's own extension using UIActivityViewController.excludedActivityTypes with the activityType net.whatsapp.WhatsApp.ShareExtension but since iOS 8.1 this is not possible anymore (on purpose or a bug). More on that here: http://johnszumski.com/blog/excluding-third-party-apps-from-ios-8-share-sheet
My conclusion, there is no way to provide both text + media to WhatApp own sharing extension. I decided to keep my custom WhatsApp sharing extension and name it "WhatsApp (+Image)" so the user can distinguish the two.

Related

Does iOS Sharing sheet recognize all social apps on the device?

Our team is building an iOS app from which a user can share media content through social apps present on his iPhone. While testing how other apps behave, I observed that not all apps show all the available sharing options.
Specifically, I don't see the following apps in the sharing options:
Kik, WeChat, Reddit, Youtube, GroupMe, Band.
I have all these apps on my device. So expected all these apps to be shown for sharing. Should the base app explicitly handle all the sharing options?
No. Only following ActivityTypes are supported by iOS. Of course you can exclude some of these activities if you want to.
UIActivityTypePostToFacebook
UIActivityTypePostToTwitter
UIActivityTypePostToWeibo
UIActivityTypeMessage
UIActivityTypeMail
UIActivityTypePrint
UIActivityTypeCopyToPasteboard
UIActivityTypeAssignToContact
UIActivityTypeSaveToCameraRoll
UIActivityTypeAddToReadingList
UIActivityTypePostToFlickr
UIActivityTypePostToVimeo
UIActivityTypePostToTencentWeibo
UIActivityTypeAirDrop
For the app to appear in the share sheet:
The app needs to implement a sharing extension (not all do)
The sharing extension must support the type of data that is being shared (text, url, image, video...).
The user must have selected that sharing extension (by tapping on the "More" button at the end of the list)

iOS 8 UIActivity: disable specific third-party sharers?

I'm fighting with UIActivityViewController in iOS 8. I'd built a custom Pinterest sharing mechanism which works beautifully in iOS 7 -- specifically, it uploads an image to my server, and then creates a Pin with that image and a URL which I specify. This is the desired functionality.
Now, in iOS 8, Pinterest has implemented its own sharer, which accepts either a URL or an image. If a URL is included in the list of Activity Items, the sharer pops up and asks the user which image s/he wants to share from the page at that URL, and totally ignores the image which is also in the list of Activity Items. If there's no URL, and just the image, then the uploaded pin doesn't include a URL.
In order to resolve this, I need to do one of these things:
Disallow Pinterest's sharer from appearing in the list, so my customized sharer can show up instead;
Somehow specify a Source URL within a pin of an image using Pinterest's sharer (I doubt this is possible);
Remove all the other images from the generated web page. I'd really rather not do this.
Or if all else fails, it would be useful to at least be able to detect if the user has Pinterest's sharer selected to show up in their list.
Does anyone know if there's a way to achieve any of these things?
Just an idea, you could set a custom UIActivitySource on your UIActivityViewController.
Then check the incoming activity type for Pinterest. Then disable that via the exclusions.

How to open album list like photos native application?

As i saw this in "Viber" application. There is media sharing button which opens all the albums as shown in photos native application. Can we do this ? I found UIImagePickerController cannot shows both simultaneously. How show both photo gallery and video gallery simultaneously ?
You're right about UIImagePickerController here great guide, and github project for picking media.
If you want to share your media here's some cool examples:
Check this tutorial on how to share pictures via email.
If you want to share via mail -
First of all you have to Create NSData object from your PNG/JPEG image data and then implement the method: Send addAttachmentData:mimeType:filename: to your MFMailComposeViewController instance.
Also i think the best thing to use in your case to share stuff like text, pictures etc is Sharekit.

UIActivityViewControlloer don't show thumbnail for links

I am developing an iOS app that uses the UIActivityViewController to share some text and a Url. In the Facebook and Twitter services it shows a thumbnail of the site located at the URL.
Unfortunately, the site in question does not look very good at all in the thumbnail. So currently the thumbnail has a negative value in the share dialog. I would either like to prevent the thumbnail from displaying, or supply my own image for the thumbnail. What is the best method to do this?
I would like to avoid having to create my own service and/or dialog.
I have tried adding an image to the item list, however that adds a bunch of services I don't want and adds the Image to the email action and adds the image to a photo album on facebook. The first problem I can get around by blacklisting actions I don't want. And I can make my own UIActivityItemProvider to stop the email problem. However, I have no idea how to prevent the facebook problem. (See How do I customize a UIActivityViewController to show a URL link when posting to facebook and twitter?).
Here is a screenshot of the facebook sharing dialog:

Whatsapp text group share on iPhone

How can I share text - with a group - from my app - on whatsapp?
Whatsapp's current iPhone API (see here: http://www.whatsapp.com/faq/en/iphone/23559013)
Enables to share text with a specific contact - Option #1 in the above link, 'custom URL scheme'
And enables to share image, video and audio documents with contacts and groups - Option #2 in the above link, 'iOS Document Interaction API'
How do I combine the two? How do I send simple text to a group?
This is the same issue as the following question, but for iPhone:
How to share text to WhatsApp from my app?
Simply you can't, using either UIDocumentInteractionController or the WhatsAapp custom url scheme.
I Think there is no relation between a Whatsapp group and an ABGroup.

Resources