instagram - 无法将 Instagram 集成到 iOS 应用程序中

标签 instagram

我无法使用 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。

关于instagram - 无法将 Instagram 集成到 iOS 应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12375016/

相关文章:

api - 我们如何为客户获取实时 Instagram 位置通知?

reactjs - Next.js 模块未找到 : Can't resolve 'tls'

swift - 使用 UIActivityViewController 在 Twitter、Instagram 和其他服务上分享视频和文本

requirejs - 使用 requirejs 嵌入 instagram 视频

instagram - Instagram 的短代码中可以包含哪些字符?

使用下一页 token 的 Pythonic 方式

ios - Instagram hooks 预选媒体问题

java - 在 GAE 上高效实现 "following"功能

ios - 如何解决IOS中的auth错误“重定向URI与注册的重定向URI不匹配”?

python - 如何使用 scrapy 抓取 Instagram 查询?