Instagram挂钩com.instagram.exclusivegram的实时应用程序

时间:2015-01-06 09:54:00

标签: ios instagram

我想与Instagram分享照片。该应用程序(ios7 +)在AppStore上正常运行。对于我的测试设备或模拟器,此代码可以正常工作。

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"instagram://app"]]) {
    _fileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"instagramPhoto.igo"]];
    NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: self.imageForInstagram]];
    UIImage * img = [UIImage imageWithData:imageData];
    [UIImagePNGRepresentation(img) writeToURL:_fileURL atomically:YES ];
    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", _fileURL]];
    self.documentInteractionForInstagram = [UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
    self.documentInteractionForInstagram.delegate = self;
    self.documentInteractionForInstagram.UTI = @"com.instagram.exclusivegram";
    self.documentInteractionForInstagram.annotation = [NSDictionary dictionaryWithObject:@"title" forKey:@"InstagramCaption"];
    [self.documentInteractionForInstagram presentOpenInMenuFromRect:CGRectMake(0 ,0 , 0, 0) inView:self.viewTosend.view animated:YES];
}

对于我获得的实时应用: enter image description here

并没有发生任何事情(我在我的直播设备上有Instagram应用程序,我正在登录)。

我忘记了什么吗?实时应用程序有什么不同?

1 个答案:

答案 0 :(得分:0)

documentInteractionForInstagram的委托不是self,是viewTosend。 (仅限ios8)

    self.documentInteractionForInstagram.delegate = (id)self.viewTosend.view;