Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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];
}
like image 866
Au Ris Avatar asked Sep 24 '13 16:09

Au Ris


2 Answers

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.

like image 173
Petro Korienev Avatar answered Oct 07 '22 18:10

Petro Korienev


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...

like image 26
user3728728 Avatar answered Oct 07 '22 19:10

user3728728