简体   繁体   中英

UIActivityViewController doesn't show FB and Twitter on iOS 7

I am trying to share some items using UIActivityViewController. On iOS 6 it works fine. But when I test it on iOS 7 only mail icon shows up. In doubt that my SDK was too old I downloaded the most recent one, but it's still behaves the same. I tested on both simulator and a device with facebook installed on it, no luck.

Now I am running out of ideas what I do wrong.

Here is my code

- (void)shareButtonWasTapped:(BMPopUpMenuView *)popUpMenu {

NSString *shareText;

if (_correctPatternFound) {
    shareText = @"Yey, I solved a puzzle!";
}
else {
    shareText = @"I am solving a photzle...";
}

NSURL *shareURL = [NSURL URLWithString:@"http://somewebsite.com"];

NSArray *items   = [NSArray arrayWithObjects:
                    shareText,
                    _shareImage,
                    shareURL, nil];


UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
[activityViewController setValue:shareText forKey:@"subject"];

activityViewController.excludedActivityTypes =   @[UIActivityTypeCopyToPasteboard,
                                                   UIActivityTypePostToWeibo,
                                                   UIActivityTypeSaveToCameraRoll,
                                                   UIActivityTypeCopyToPasteboard,
                                                   UIActivityTypeMessage,
                                                   UIActivityTypeAssignToContact,
                                                   UIActivityTypePrint];

[self presentViewController:activityViewController animated:YES completion:nil];
}

They won't show when you don't have Twitter and Facebook accounts set up in settings. Facebook or twitter app are not enough - you should have explicitly set accounts.
Maybe it's not really cool, (user may want to share something on fb or twitter and perform login for it) but Apple considered these activities should work so in iOS 7.

As Ahmed said above There is a problem in IOS 8.3 to use Facebook text sharing even if you add Facebook account in the setting.

I recently post this problem in sharing facebook text using uiactivityviewcontroller

In my opinion this is a bug that apple have to fix. maybe in the next version...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM