• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

无法在iOS应用中集成Instagram

instagram 来源:kashif789us 3次浏览

我无法使用ios App在Instagram上发布我的照片。我从stackoverflow的帖子中得到了下面的代码,但它不起作用。当Instagram启动时,它显示错误无法打开文件。请帮助我。无法在iOS应用中集成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的最低分辨率为612×612。总是JPG。


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)