Show only email+ (Any specific app) as shareable option in UIActivityViewController - ios

Is there any way by which we can get rid of all default sharing options provided by UIActivityViewController and display only specific apps (in my case Email+) as sharing medium.

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)

Prevent sharing with UIActivityViewController to certain apps

From my iOS-App I would like to disable sharing to Apps like Tumblr or Instapaper. My instance of UIActivityViewController has the property excludedActivityTypes, but what exactly do I put into this array?
For example, when Tumblr-sharing succeeds, the activity name, taken from completionWithItemsHandler is com.tumblr.tumblr.Share-With-Tumblr. But adding this string to excludedActivityTypes doesn't remove Tumblr from the list of choices.

Share text AND media with WhatApp Share Extension

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.

Pop WeChat/Weixin Safari-like Share Sheet in my app UIActivityViewController?

I'm trying to pop the built in Safari share WeChat in my iOS app. But can't find a way to make WeChat app show up in the UIActivityViewController!
I noticed that the WeChat app icon shows up when sharing images from the Photo Gallery, and Safari link sharing. The native Notes app doesn't have WeChat option.
Not sure how that's working, any help is appreciated! Thanks!
This is done using "Share" extensions. See Apple docs for more information: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ShareSheet.html#//apple_ref/doc/uid/TP40014214-CH12-SW1
Regarding why some apps appear in certain sharing contexts but not in others, this is because a Share extension has to declare to iOS which kind of data it supports for sharing. Presumably, WeChat developers did not enable their Share extension for "pure" text content, like in the Notes app. See here for how to set which kind of data a Share extension accepts: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8
Unfortunately you won't be able to add the WeChat Share extension on behalf of them if they didn't allow it, but you might be able to use some WeChat API to develop your own app extension with text content enabled.
Hope it helped.
WeChat's icon won't appear in UIActivityViewController if you try to share anything other than URL. WeChat only accepts URL posts. This code snippet should work for you:
NSArray *items = #[[NSURL URLWithString:#"http://google.com"]];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];

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.

Resources