iOS iPhone SDK将应用程序与instagram集成[复制]

参见英文答案 > Pulling Instagram images to my app [closed]                                    2个
将应用程序与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"];

    UIImage *image = [UIImage imageNamed:@"instagram.jpeg"];

    NSData *imageData = UIImagePNGRepresentation(image);
    [imageData writetoFile:savedImagePath atomically:YES];
    NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath];
    NSLog(@"%@",imageUrl);
    UIDocumentInteractionController *docController = [[UIDocumentInteractionController alloc] init];
    docController.delegate = self;
    docController.UTI = @"com.instagram.photo";
    docController.URL = imageUrl;
    [docController setURL:imageUrl];
    [docController presentOpenInMenuFromrect:CGRectZero inView:self.view animated:YES];
}

解决方法

在iOS中使用Instagram API现在要简单得多.看看这个新的SDK http://github.com/shyambhat/InstagramKit

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...