我的应用程序正在生成一个图像,我正尝试使用文档交互控制器和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];
}有什么想法?
发布于 2012-12-09 00:26:40
对于使用arc的应用程序,UIDocumentsInteractionController shows iBooks but doesn't open it提供了正确的答案。UIDocumentInteractionController必须是该类的属性。
但也是!
如果您支持ios5,请确保您保存的图像是".igo“类型(而不是.jpg或.png)。
IOS6将在instagram上打开它,但iOS6以下的用户只会关闭UIDocumentInteractionController,而不会继续使用instagram。
https://stackoverflow.com/questions/9952725
复制相似问题