我試圖與微信分享圖片,網址和文字,但我收到此消息。我很簡單地使用UIActivityViewController與微信共享內容。但無法分享。UIActivityViewController不與微信分享
這裏是我的代碼:
UIImage * shareImage = [UIImage imageNamed:@"igo-logo-small"];
UINavigationController * nav = fromVC.navigationController;
// error handling
NSString * error = nil;
for (;;) {
// sanity
if (text == nil || url == nil || shareImage == nil || nav == nil) {
error = @"arguments not all valid";
break;
}
// setup share controller
UIActivity *activity = [[UIActivity alloc] init];
NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
FilteredActivityViewController * activityController = [[FilteredActivityViewController alloc] initWithActivityItems:@[text, shareImage, url] applicationActivities: applicationActivities];
if (activityController == nil) {
error = @"share controller nil";
break;
}
// success - made it to end
[nav presentViewController:activityController animated:YES completion:nil];
activityController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
NSLog(@"completionWithItemsHandler, activityType: %@, completed: %d, returnedItems: %@, activityError: %@", activityType, completed, returnedItems, activityError);
if ([activityType isEqualToString:@"com.apple.UIKit.activity.CopyToPasteboard"] && completed) {
[MBProgressHUD showSuccessWithoutImage:@"Copied" toView:nav.view];
}
};
你解決呢?我的應用程序顯示相同,它用於工作。 – Pierre