【发布时间】:2014-08-07 06:01:56
【问题描述】:
我正在尝试创建一个应用程序,在我的应用程序中编辑图片后,它会在其中打开 Instagram。我希望它在进入 instagram 时在描述中包含一个标签,但我似乎迷失了如何实现它。 iphone 挂钩状态使用标语,但我不知道在哪里放置。下面是我的代码
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
docInteraction.delegate = self;
Saves the edited Image to directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"instaFilterx.jpg"];
UIImage *image = combinedImage;
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:NO];
//Loads the edited Image
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:@"instaFilterx.jpg"];
UIImage *tempImage = [UIImage imageWithContentsOfFile:getImagePath];
Hooks the edited Image with Instagram
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/instaFilterx.igo"];
[UIImageJPEGRepresentation(tempImage, 1.0) writeToFile:jpgPath atomically:YES];
Prepares the DocumentInteraction with the .igo image for Instagram
NSURL *instagramImageURL = [[NSURL alloc] initFileURLWithPath:jpgPath];
docInteraction = [UIDocumentInteractionController
interactionControllerWithURL:instagramImageURL];
[docInteraction setUTI:@"com.instagram.exclusivegram"];eciate any help. Thank you.
【问题讨论】: