UIDocumentInteractionController Ngăn chặn thả dù trong 'Open in' tấm
Trong ứng dụng của tôi, tôi cho phép người dùng chia sẻ hình ảnh qua Instagram, đòi hỏi việc sử dụng các UIDocumentInteractionController. Airdrop được tự động phát hiện nếu điện thoại hỗ trợ nó. Làm cách nào để xóa nó khỏi trang hoạt động 'Mở trong' này?
Thậm chí nếu tôi bắt đầu quá trình chia sẻ với UIActivityViewController và gọi setExcludedActivityTypes :, cuối cùng tôi phải sử dụng UIDocumentInteractionController, và khi tôi làm, Airdrop xuất hiện trở lại. Đây là mã khi nút chia sẻ được nhấn vào:
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");
}
Có cùng sự cố. – n13