无法在iOS应用中集成Instagram
我无法使用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的最低分辨率为612x612。总是JPG。
回答:
完成起见,最小分辨率保持在612x612(这是由于显示视网膜上的图像的设备),但现在的Instagram支持JPEG和PNG图像。发送到Instagram的所有非正方形图像必须在发布前裁剪。
以上是 无法在iOS应用中集成Instagram 的全部内容, 来源链接: utcz.com/qa/259440.html