UIDocumentInteractionController防止空投在“打开的”片
在我的应用程序,我允许用户通过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");
}
有同样的问题。 – n13