Instagram iphone挂钩说明

时间:2014-08-07 06:01:56

标签: ios iphone hook instagram

我正在尝试创建一个应用程序,它在我的应用程序中编辑图片后打开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.

1 个答案:

答案 0 :(得分:0)

为Instagram帖子添加标题。执行以下操作:

docInteraction.annotation=[NSDictionary dictionaryWithObjectsAndKeys:@"Your #Text", @"InstagramCaption", nil];

希望这有帮助。