facebooktwitterios7uiactivityviewcontroller

Issue posting file url using UIActivityViewController


I am trying to share my app document (file url ) using UIActivityViewController. When activityviewcontroller pop up (testing on iPad device), I get only iMessage and Mail options. I DO NOT GET OTHER OPTIONS like Facebook, Twitter, Copy, Print, etc. Why? Please help me. I need Facebook, twitter options also. File type which I am sharing using NSURL is .txt

Note: I am already signed in to my Facebook, twitter account in iOS settings.

Source code which I am using:

NSURL *url = [NSURL fileURLWithPath:self.path];

NSArray *objectsToShare = @[url];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];


if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

    [APP_VIEW_CONTROLLER presentViewController:activityViewController animated:YES completion:nil];
}
else
{

    if (![self.activityPopover isPopoverVisible]) {
        self.activityPopover = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
        [self.activityPopover presentPopoverFromRect:pathViewController.pathViewWrapper.pathView.bounds inView:pathViewController.pathViewWrapper.pathView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
    else
    {
        //Dismiss if the button is tapped while pop over is visible
        [self.activityPopover dismissPopoverAnimated:YES];
    }
}

Solution

  • It is indeed mysterious what shows up in the UIActivityViewController. Regarding Facebook and Twitter 1) it likely needs to be an http or https URL (not a file URL), 2) make sure those services are configured on the simulator or iOS device you're using.