我的应用正在生成一张图片,我正试图使用文档交互控制器和their hook传递给Instagram。哦,这是使用iOS 5.1。
我正确显示了UIDocumentInteraction操作表,但问题是,一旦用户选择“在Instagram中打开”,该表将被解除,并且没有任何反应。
代码:
// Method returns a path to the generated image
NSURL *finalCompositePath = [NSURL fileURLWithPath:[self generateFinalImage:@"instagram"]];
UIDocumentInteractionController *documentInteractionController;
NSURL *instagramURL = [NSURL URLWithString:@"instagram://camera"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
//imageToUpload is a file path with .ig file extension
documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:finalCompositePath];
documentInteractionController.UTI = @"com.instagram.exclusivegram";
documentInteractionController.delegate = self;
documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"Caption Test" forKey:@"InstagramCaption"];
[documentInteractionController presentOptionsMenuFromBarButtonItem:self.ShareButton animated:YES];
}
思想?
答案 0 :(得分:3)
UIDocumentsInteractionController shows iBooks but doesn't open it有正确的答案。 UIDocumentInteractionController必须是类的属性。
但也是!!!
如果您支持ios5,请确保您保存的图像是“.igo”类型(不是.jpg或.png)。
IOS6将在Instagram中打开它,但IOS少于6只会解除UIDocumentInteractionController,而不会进入Instagram。