我在我的 iOS 应用程序中使用以下代码来使用 Instagram iPhone 挂钩将照片发布到 Instagram。我只希望“打开方式...”菜单有 Instagram 应用程序,没有其他应用程序。但就我而言,Camera+ 也出现了。如何限制 Instagram?
另外,我可以直接打开 Instagram 而不是显示“打开方式”菜单吗?
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
//imageToUpload is a file path with .ig file extension
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imageToUpload]];
self.documentInteractionController.UTI = @"com.instagram.photo";
self.documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"my caption" forKey:@"InstagramCaption"];
[self.documentInteractionController presentOpenInMenuFromBarButtonItem:self.exportBarButtonItem animated:YES];
}