【发布时间】:2014-11-09 21:06:37
【问题描述】:
当我使用UIDocumentInteractionController 允许用户通过 Instagram 分享时,它确实有效,它提供了“打开方式”和“Instagram”选项作为选项之一......问题是它还显示许多其他应用程序,如“Facebook”和“Twitter”......
有什么方法可以让它只提供在 instagram 应用中打开的选项?
Instagram 声称有办法做到这一点:http://instagram.com/developer/iphone-hooks/ 但他们提到了这一点:
"Alternatively, if you want to show only Instagram in the application list (instead of Instagram plus any other public/jpeg-conforming apps) you can specify the extension class igo, which is of type com.instagram.exclusivegram."
但老实说,我不知道这部分是什么意思,“
extension class igo”
我的代码:
UIImage *imageToUse = [UIImage imageNamed:@"imageToShare.png"];
NSString *documentDirectory=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"Image.ig"];
NSData *imageData=UIImagePNGRepresentation(imageToUse);
[imageData writeToFile:saveImagePath atomically:YES];
NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
docController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];
docController.delegate = self;
docController.annotation = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"This is the users caption that will be displayed in Instagram"], @"InstagramCaption", nil];
docController.UTI = @"com.instagram.exclusivegram";
[docController presentOpenInMenuFromRect:CGRectMake(1, 1, 1, 1) inView:self.view animated:YES];
【问题讨论】:
-
显示此错误 - *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:UIDocumentInteractionController 过早地消失了! ios 10.3
标签: ios objective-c instagram uidocument uti