Alb*_*haw 5 objective-c uti ios instagram uidocument
当我UIDocumentInteractionController用来允许用户通过Instagram分享它确实有效时,它会提供"打开方式"和"Instagram"作为选项之一的选项......问题是它还会显示许多其他应用程序,如"Facebook" "和"推特"......
有什么方法我可以让它只提供在Instagram应用程序中打开的选项?
"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];
Run Code Online (Sandbox Code Playgroud)

Alb*_*haw 11
原来让doc控制器只在Instagram中打开你只需保存你的png或jpg文件格式为".igo"文件类型扩展名,(也许代表Instagram-Only?)
改变了我的代码中的第三行代码来读取相反:
NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"Image.igo"];
Run Code Online (Sandbox Code Playgroud)
(用"igo")
然后它工作了!:)
| 归档时间: |
|
| 查看次数: |
4709 次 |
| 最近记录: |