当我用苹果的UIActivityViewController
把几张图片分享到微信(weixin)。我发现有时它不起作用。大部分时候我只选择1~3张图片效果很好,但是如果我分享9张图片(微信允许的最大数量)肯定会失败,控制台会打印
2016-04-01 16:14:34.258 EverPhoto[5567:1981394] 插件 com.tencent.xin.sharetimeline 中断 2016-04-01 16:14:34.258 EverPhoto[5567:1981394] 插件 com.tencent.xin.sharetimeline 失效
这是代码:
__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
是实现协议的自定义对象UIActivityItemSource
。
PS我试用了APP Google Photo,发现它的分享功能做得很好。它可以将9张甚至系统照片的原始高清尺寸的图像共享给微信使用UIActivityViewController
。那么,我应该如何解决这个问题呢?