使用Facebook OpenGraphStories

时间:2015-05-05 09:07:54

标签: ios facebook facebook-opengraph

我正在尝试使用我的应用程序中的Open Graph Stories。 FBShareDialog用于预览共享。我可以在共享对话框中查看标题和说明。但是当我尝试与标题和描述共享图像时,共享对话框将只显示图像。它不会显示标题和说明。

以下是我的代码

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    self.photo = [[FBSDKSharePhoto alloc] init];
    self.photo.image = info[UIImagePickerControllerOriginalImage];
    self.photo.userGenerated = YES;
}

- (IBAction)btnShare_Click:(id)sender {

    FBSDKShareOpenGraphObject *object = [[FBSDKShareOpenGraphObject alloc]init];
    [object setString:@"objName" forKey:@"og:type"];
    [object setString:@"Title" forKey:@"og:title"];
    [object setString:@"Testing Image sharing" forKey:@"og:description"];
    if (self.photo) {
        [object setPhoto:self.photo forKey:@"og:image"];
    }

    FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
    action.actionType = @"action";

    [action setObject:object forKey:@"objName"];

    FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
    content.action = action;
    content.previewPropertyName = @"app:objName";

    [FBSDKShareDialog showFromViewController:self
                                 withContent:content
                                    delegate:self];
}

在共享对话框预览中,它只显示图像。它不会显示标题和描述。如果我发布它,那么帖子将包含标题和描述。

任何帮助将不胜感激

提前致谢

0 个答案:

没有答案