【发布时间】:2013-02-05 12:32:01
【问题描述】:
我使用了以下代码,但它不起作用。 我想将图像从我的应用程序放到我 iPhone 上安装的 Instagram 应用程序中。
NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"IMG_0192" ofType:@"jpg"];
fileToOpen = [fileToOpen substringToIndex:[fileToOpen length] - 3];
fileToOpen=[NSString stringWithFormat:@"%@ig",fileToOpen];
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
NSLog(@"%@",fileToOpen);
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
//imageToUpload is a file path with .ig file extension
/*UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@""
message:@"Can open app!"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
*/
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:fileToOpen]];
self.documentInteractionController.UTI = @"com.instagram.photo";
self.documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"Its a testing" forKey:@"InstagramCaption"];
我尝试了很多,但它根本不起作用。
【问题讨论】:
标签: iphone ios objective-c instagram