When I use Apple's UIActivityViewController
to share a few images to WeChat (weixin). I find that sometimes it doesn't work. Most of the time it works well when I select only 1~3 images, but if I share 9 images (largest number allowed by WeChat), it will certainly fail, and the console will print
2016-04-01 16:14:34.258 EverPhoto[5567:1981394] plugin com.tencent.xin.sharetimeline interrupted 2016-04-01 16:14:34.258 EverPhoto[5567:1981394] plugin com.tencent.xin.sharetimeline invalidated
Here is the code:
__weak typeof(self) __weakSelf = self;
self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:self.shareItems applicationActivities:nil];
self.activityViewController.excludedActivityTypes = @[UIActivityTypePostToFacebook,
UIActivityTypePostToTwitter,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo,
UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
];
self.activityViewController.completionWithItemsHandler = ^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
DLog(@"shareCompleted : %@", completed ? @"YES" : @"NO")
__weakSelf.shareItems = nil;
__weakSelf.activityViewController = nil;
};
[self.containerVc presentViewController:self.activityViewController animated:YES completion:nil];
ShareItems
is the custom object that implemented the protocol UIActivityItemSource
.
P.S. I tried APP Google Photo and found it has done very well in its share function. It can share 9 images with even original HD size of system photo asserts to WeChat using UIActivityViewController
.
So, how should I solve this problem?