我无法从我的应用程序中打开 Instagram。这是我正在使用的代码:
NSString *imageToUpload = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/mapapic-instagram.igo"];
NSData *imageData = UIImageJPEGRepresentation(image, 0.8);
[imageData writeToFile:imageToUpload atomically:YES];
_documentInteractionController
= [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imageToUpload]];
_documentInteractionController.delegate = self;
_documentInteractionController.UTI = @"com.instagram.exclusivegram";
NSString *defaultInstagramText = @"Hello";
_documentInteractionController.annotation = @{ @"InstagramCaption" : defaultInstagramText };
BOOL success = [_documentInteractionController presentOpenInMenuFromRect:CGRectZero
inView:self.view.window
animated:YES];
最后一次调用返回 YES。然而什么也没发生,Instagram 也没有打开。UIDocumentInteractionControllerDelegate
方法不被调用。我安装了 Instagram 应用程序。我究竟做错了什么?