简体   繁体   中英

ActivityItems in UIActivityViewController don't show up

I'm developing an app in iOS 7 and in it I need to show an activity controller. Below is my code,

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[UIActivityTypeSaveToCameraRoll, UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypeMail, UIActivityTypeMessage, UIActivityTypePrint] applicationActivities:nil];
    [self presentViewController:activityVC animated:YES completion:nil];

But when its presented, this is how it looks.

在此处输入图片说明

None of the activity types I added in the array shows up. Why is this happening? Am I missing something? I'd like some help to get this working. I especially need the Facebook, twitter sharing and the saving to the local storage options here.

Thank you.

Edit: I checked on a real device and the Facebook and Twitter sharing options show up. However UIActivityTypeSaveToCameraRoll , UIActivityTypePrint still aren't showing up.

The Items will show up only if you have integrated them to your Device. If you have integrated facebook and Logged into facebook in the settings then Facebook will appear along the Items. That means your device must be Synchronised with the native Facebook, Twitter, etc Apps for them to show up in the UIActivityViewController

Edit:

Try using like this

UIActivityViewController *ActivityView;
ActivityView =
[[UIActivityViewController alloc]
 initWithActivityItems:Items applicationActivities:nil];

[self presentViewController:ActivityView animated:YES completion:nil];

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