【问题标题】:Unable to Integrate Instagram in iOS App无法在 iOS 应用程序中集成 Instagram
【发布时间】:2014-11-07 18:32:59
【问题描述】:

我无法使用 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];
    }

【问题讨论】:

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

标签: instagram


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-26
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多