Подтвердить что ты не робот

Instagram hook com.instagram.exclusivegram не столь эксклюзивный

Насколько я знаю, вы должны использовать com.instagram.photo, чтобы получить общие параметры и com.instagram.exclusivegram для документа interfacecontroller 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 ];
}

Screenshot

4b9b3361

Ответ 1

Использование расширения файла igo верное, а количество приложений, которые появятся в списке, значительно меньше, чем при использовании ig. Из моего тестирования (только для iOS 9) UTI не имело никакого отношения к представленному списку.

Похоже, что iPhone hooks doc устарел.

Ответ 2

self.documentInteractionController.UTI = @"com.instagram.exclusivegram";
self.documentInteractionController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];

Кажется, что строка UTI перезаписывается методом setupControllerWithURL:usingDelegate:.

Ответ 3

Вам нужно создать временную копию изображения с расширением "ig" или "igo", а затем поделиться им с UTI "com.instagram.exclusivegram". Это должно предоставить DocumentInteractionController только с опцией Instagram:

if (![fm fileExistsAtPath:tempDirectory])
[fm createDirectoryAtPath:tempDirectory withIntermediateDirectories:YES attributes:nil error:nil];

NSString *tempInstagramPath = [tempDirectory stringByAppendingPathComponent:@"instagramShare.igo"];
if ([fm fileExistsAtPath:tempInstagramPath])
    [fm removeItemAtPath:tempInstagramPath error:nil];

[UIImageJPEGRepresentation(imageToShare, 1.0) writeToFile:tempInstagramPath atomically:NO];

documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:tempInstagramPath]];
documentInteractionController.delegate = self;
documentInteractionController.UTI = @"com.instagram.exclusivegram";
documentInteractionController.annotation = @{@"InstagramCaption": @"My Photo Caption!"};
if (![documentInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated:YES])
    NSLog(@"Cannot open Document Interaction Controller for sharing with Instagram");