1

I am having an issue with the UIActivityViewController on my apps since I updated to iOS 8.3. Twitter, Mail, and Messages displays fine, but Facebook is not there. I have checked my code to ensure that I didn't accidentally list it in an excluded activity, and made sure I am signed in on Facebook within my phone settings. I can verify that it works on simulator, but not in my phone. Any ideas what may be going on here?

UPDATE

Somehow, it is related to the Facebook app itself. If I remove Facebook from my iPhone, the option to share via Facebook comes back. If I reinstall the Facebook app, I can no longer share to Facebook. Any ideas why this is doing it?

-(IBAction) invite {
    NSCalendar* gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease];
    NSDateComponents* theDateComponents = [gregorian components: NSWeekdayCalendarUnit fromDate: [NSDate date]];
    NSInteger weekDay = theDateComponents.weekday;
    if ( weekDay == 1 || weekDay >= 5 ) {
        NSString *invitation = @"Join me @ Fritch Church of Christ Sunday!  Bible Class @9:45AM Worship @10:45AM & 6:00PM!";

        NSArray *activityItems = @[invitation];

        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

        activityVC.excludedActivityTypes = @[ UIActivityTypePostToWeibo,
                                              UIActivityTypeCopyToPasteboard,
                                              UIActivityTypeAssignToContact,
                                              UIActivityTypePrint ];

        if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
        {
            UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:activityVC];
            [aPopover presentPopoverFromRect:[invite frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
        }
        else {

            [self presentViewController:activityVC animated:YES completion:nil];
        }
    }
    else {
        NSString *invitation = @"Join me @ Fritch Church of Christ this Wednesday! Devotional & Bible Class @7!";
        NSArray *activityItems = @[invitation];

        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

        activityVC.excludedActivityTypes = @[ UIActivityTypePostToWeibo,
                                              UIActivityTypeCopyToPasteboard,
                                              UIActivityTypeAssignToContact,
                                              UIActivityTypePrint ];

        if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
        {
            UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:activityVC];
            [aPopover presentPopoverFromRect:[invite frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
        }
        else {

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


    }

}

From simulator enter image description here

From actual iPhone (both are signed into Facebook)enter image description here

user717452
  • 33
  • 14
  • 73
  • 149

1 Answers1

0

It appears that the latest Facebook iOS app update embeds an app extension which takes precedence over the Apple native Facebook extension.

Indeed, I could see it because on both cases (Facebook app installer or not) the NSString *activityType given by the UIActivityViewController completion block is com.apple.UIKit.activity.PostToFacebook which matches the const string UIActivityTypePostToFacebook.

I think it explains the behaviour you (and I) encountered.

For your information, I managed to display the Facebook in the UIActivityViewController in both cases with the following workaround: providing at least one NSURL * item to share.

But it seems that when the Facebook app is installed, other items such as NSString * are not taken into account :(

It is likely to be a Facebook app issue and I hope it will be fixed in future app releases so we can have the same behaviour whether the Facebook app is installed or not.

EDIT (May 22 2015)

I am afraid it is not an issue given Facebook terms: see DeepFriedTwinkie's answer on a related question: https://stackoverflow.com/a/30020929/2743762

EDIT (May 27 2015)

The current Facebook app (v 31.0) fixes the problem

Community
  • 1
  • 1
paillou
  • 354
  • 1
  • 8