无法在iOS应用程序中集成Instagram

无法在iOS应用程序中集成Instagram,instagram,Instagram,我无法使用ios应用程序在instagram上发布我的照片。我从stackoverflow上的一篇文章中获得了以下代码,但它不起作用。Instagram启动时,会显示错误“无法打开文件”。请帮帮我 NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {

我无法使用ios应用程序在instagram上发布我的照片。我从stackoverflow上的一篇文章中获得了以下代码,但它不起作用。Instagram启动时,会显示错误“无法打开文件”。请帮帮我

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
    if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {

        NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
        NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.ig"];
        NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"Icon.png"]);
        [imageData writeToFile:savedImagePath atomically:YES];
        NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath];
        docController = [[UIDocumentInteractionController alloc] init];
        docController.delegate = self;
        [docController retain];
        docController.UTI = @"com.instagram.photo";
        [docController setURL:imageUrl];
        [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
    }else{

        UIAlertView *errorToShare = [[UIAlertView alloc] initWithTitle:@"Instagram unavailable " message:@"You need to install Instagram in your device in order to share this image" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [errorToShare show];
        [errorToShare release];
    }

instagram的最低分辨率为612x612。始终是JPG。

为了完成,最低分辨率保持在612x612(这是因为在视网膜设备上显示图像),但Instagram现在同时支持JPEGPNG图像。发送到Instagram的所有非方形图像必须在发布前进行裁剪。

我刚刚用612x612 jpeg图像对其进行了测试,效果良好。它不适用于png或更小的分辨率