是否可以安全地从iOS 10中的UIActivityViewController中排除Notes和Reminders?

时间:2016-07-10 08:39:36

标签: ios objective-c swift uiactivityviewcontroller

我之前尝试过使用这篇文章中的答案 -

How to exclude Notes and Reminders apps from the UIActivityViewController?

但他们都没有为我工作。 有谁知道在iOS 10中是否有删除它们的选项? 或者更好的解决方案,适用于iOS 9? 感谢

1 个答案:

答案 0 :(得分:0)

这对我有用......

NSString *text = @"XYZ";
UIImage *image = [UIImage imageNamed:@"ABC"];
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[text, image] applicationActivities:nil];

controller.excludedActivityTypes = @[UIActivityTypePostToWeibo,
                                     UIActivityTypeMail,
                                     UIActivityTypePrint,
                                     UIActivityTypeCopyToPasteboard,
                                     UIActivityTypeAssignToContact,
                                     UIActivityTypeSaveToCameraRoll,
                                     UIActivityTypeAddToReadingList,
                                     UIActivityTypePostToFlickr,
                                     UIActivityTypePostToVimeo,
                                     UIActivityTypePostToTencentWeibo,
                                     UIActivityTypeAirDrop,
                                     UIActivityTypeOpenInIBooks,
                                     @"com.apple.mobilenotes.SharingExtension",
                                     @"com.apple.reminders.RemindersEditorExtension"];

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