Instagram iPhone挂钩 - 照片没有导出

时间:2012-12-15 08:45:37

标签: iphone objective-c xcode instagram

你能告诉我,我做错了什么,照片没有在新的Instagram中显示?它根本不会出口。

编辑:我发现问题是它没有显示在Instagram的预览中。当我进入“下一步”时,可以看到缩略图。如果重要的话,我的输出图片是1000x1000。

NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Image.igo"];

// Write image to PNG
[UIImageJPEGRepresentation(preview.image, 1.0) writeToFile:savePath atomically:YES];

NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];

if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) 
{
    //imageToUpload is a file path with .ig file extension
    documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];

    documentInteractionController.UTI = @"com.instagram.exclusivegram";
    documentInteractionController.delegate = self;

    documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"bla bla bla" forKey:@"InstagramCaption"];
    [documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];