3

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!

enter image description here

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!

KBog
  • 3,800
  • 1
  • 25
  • 31
  • Have you found any solution? – Prachi Rajput Feb 12 '15 at 12:36
  • I ended up downloading their SDK from a link that someone provided here: http://stackoverflow.com/questions/23539049/wechat-sdk-on-arm64/24879548?noredirect=1#comment45184394_24879548 – KBog Feb 23 '15 at 07:57
  • Thanks for reply, but i could the way for sending multiple images at the same time by using weixin sdk. – Prachi Rajput Feb 23 '15 at 09:09
  • [Here is a guide](http://stackoverflow.com/questions/35718897/how-to-add-the-wechat-api-to-a-swift-project) on getting the WeChat SDK set up. – Suragch Mar 11 '16 at 07:02

2 Answers2

3

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.

Romain
  • 3,718
  • 3
  • 32
  • 48
  • Thanks for the quick reply! I was trying to install their SDK, but it doesn't compile on arm64. I even went to their Chinese website to get the most recent version: https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&lang=zh_CN Still can't compile :| – KBog Feb 07 '15 at 19:39
  • Good luck with that :) if you encounter problems with their SDK, please post your questions in another thread, as it has nothing to do with the subject discussed here. – Romain Feb 07 '15 at 20:06
2

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];
Kristian Vukusic
  • 3,284
  • 6
  • 30
  • 46
aareeph
  • 875
  • 1
  • 12
  • 20