Открыть изображение в Instagram

Привет, мне нужно импортировать отредактированное изображение в Instagram, что-то вроде PhotoStudio:

enter image description here

Я сделал снимок с помощью этого кода:

    UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

Затем мне нужно открыть это screenShotс Instagram:


EDITED:

Я применяю метод, подобный этому:

    UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];

    docFile.UTI = @"com.instagram.photo";
    [self setupDocumentControllerWithURL:igImageHookFile];

    NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"];
    if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
        [[UIApplication sharedApplication] openURL:instagramURL];
    }

    else {   
        NSLog(@"No Instagram Found");
    }
}

Но я получаю этот результат:

2012-05-05 21:55:36.842 InstantFrame[855:707] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-1914.84/UIDocumentInteractionController.m:1094
2012-05-05 21:55:36.848 InstantFrame[855:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme (null).  Only the file scheme is supported.'

Instagram будет открыт, но ничего не импортирует.

6
задан Perception 6 May 2012 в 11:10
поделиться

0 ответов

Другие вопросы по тегам:

Похожие вопросы: