Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActivityViewController include rather than exclude Activity Types

I am using UIActivityViewController. For a particular share message, I only want to offer users the UIActivityTypePostToFacebook (i.e. only share via facebook). I realise I can use the excludedActivityTypes method to exclude all the other current Activity Types.

However, my fear with this approach is that in the future more Activity Types might appear and so my app will automatically add those in for future OS versions.

Therefore, I was wondering is there a way to state only the Activity Types you want to have appear (i.e. an includedActivityTypes version of the excludedActivityTypes method)

Cheers, Charlie

like image 855
Charlie Seligman Avatar asked Feb 04 '14 09:02

Charlie Seligman


2 Answers

If you are using SLComposeViewController user only post a message to facebook. Before using SLComposeViewController you need to add Social FrameWork.

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [controller setInitialText:@"Using Facebook to share your Images"];
    [controller addImage:PresentImg];
    [self presentViewController:controller animated:YES completion:Nil];
}
like image 166
Mahe Avatar answered Oct 16 '22 14:10

Mahe


In UIActivityViewController, there is no such feature. One thing to remind you, Your fear is correct. But there is no need to fear about this. Because If your build installed in device, even if it will be update with new version of IOS, it won't update app's feature that already exists. That's before going to update your app with new version of xcode(assume new xcode has feature which you fear about), your app won't show more than this. Else if you want to give update with new xcode, You must handle this situation in new version.

like image 1
Mani Avatar answered Oct 16 '22 15:10

Mani