我需要让我的应用程序打开来自Safari和Mail应用程序的文档,并在UIDocumentInteractionController课堂上打开"Open In ..." .我该如何做到这一点?

在我的应用程序中,我允许用户通过Instagram共享照片,这需要使用UIDocumentInteractionController.如果手机支持,则会自动检测到Airdrop.如何从"打开方式"操作表中删除它?
即使我使用UIActivityViewController开始共享过程并调用setExcludedActivityTypes:,最终我必须使用UIDocumentInteractionController,当我这样做时,Airdrop再次出现.以下是分享按钮时的代码:
NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.igo"];
NSData *imageData = UIImagePNGRepresentation(imageToShare);
[imageData writeToFile:savedImagePath atomically:YES];
NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath];
docController = [[UIDocumentInteractionController alloc] init];
docController.UTI = @"com.instagram.exclusivegram";
docController.URL = imageUrl;
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}
else
{
NSLog(@"no insta");
}
Run Code Online (Sandbox Code Playgroud)