UIDocumentInteractionController通过Instagram(和仅限Instagram)共享]]

问题描述 投票:5回答:2

[当我使用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];

[当我使用UIDocumentInteractionController允许用户通过Instagram共享时,它确实起作用,它显示了“打开方式”和“ Instagram”的选项作为选项之一...问题是它...

ios objective-c instagram uidocument uti
2个回答
11
投票

[结果是让文档控制器仅在Instagram中打开,您只是将png或jpg文件保存为文件扩展名为“ .igo”,(也许代表Instagram?)更改了我代码中的第三行代码以改为阅读:


0
投票

iOS 13的较低版本:NSString * saveImagePath = [documentDirectory stringByAppendingPathComponent:@“ Image.igo”];

© www.soinside.com 2019 - 2024. All rights reserved.