Instagram钩子com.instagram.exclusivegram不那么独占

wou*_*rds 22 api hook ios instagram

据我所知,你必须使用com.instagram.photo获得常规选项和com.instagram.exclusivegram为documentinteractioncontroller的UTI如果你真的只想要的Instagram +使用正确的扩展.ig一般和.igo独家Instagram的.

出于某种原因,我看到了多个选项,而不仅仅是我喜欢的Instagram ...

我忘记了什么吗?它有不同的做法吗?

UIImage *image = (UIImage *)[info valueForKey:UIImagePickerControllerOriginalImage];

NSURL *instagramURL = [NSURL URLWithString:@"instagram://"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    CGRect rect = CGRectMake(0,0,0,0);
    CGRect cropRect=CGRectMake(0,0,612,612);
    // ig voor gewone instagram, igo voor exclusive instagram
    NSString *jpgPath=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/temp/photo.igo"];
    CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], cropRect);
    UIImage *img = [[UIImage alloc] initWithCGImage:imageRef];
    CGImageRelease(imageRef);
    [UIImageJPEGRepresentation(img, 1.0) writeToFile:jpgPath atomically:YES];

    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@",jpgPath]];
    // exclusive zou direct in de instagram app moeten openen, helaas toont hij meerdere opties met instagram ergenes helemaal achteraan
    self.documentInteractionController.UTI = @"com.instagram.exclusivegram";
    self.documentInteractionController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
    self.documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"Alweer een Nostalgie deelnemer! #nostalgiebusje" forKey:@"InstagramCaption"];
    [self.documentInteractionController presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
}
Run Code Online (Sandbox Code Playgroud)

截图

Ric*_*tos 6

使用文件扩展名igo是正确的,列表中显示的应用程序数量远少于您使用的应用程序数量ig.从我的测试(仅限iOS 9)开始,UTI对呈现的列表没有任何影响.

看起来iPhone钩子doc已经过时了.


vok*_*lam 5

self.documentInteractionController.UTI = @"com.instagram.exclusivegram";
self.documentInteractionController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
Run Code Online (Sandbox Code Playgroud)

似乎UTI字符串被setupControllerWithURL:usingDelegate:方法覆盖.