FacebookSDK:在我的时间线上用文本/链接分享图片



在没有共享对话框的情况下可以这样做吗?因为到目前为止,我还没有找到任何允许的东西。

这是唯一没有任何文字的共享照片:

[FBRequestConnection startForUploadPhoto:self.imageToShare completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { }];

这只是没有照片的共享文本:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               self.titleToShare, @"name",
                               self.textToShare, @"description",
                               self.linkToShare, @"link",
                               @"http://www.somesite.com/logo_i.png", @"picture", nil];
[FBRequestConnection startWithGraphPath:@"/me/feed" parameters:params HTTPMethod:@"POST"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { }];

我该怎么办?

提前谢谢。

所以我在搜索了一段时间后找到了正确的答案,用你想要的文本发布的最好方法是这样的:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               UIImageJPEGRepresentation(self.imageToShare, 1), @"source",
                               self.textToShare, @"message",
                               (self.linkToShare)?self.linkToShare:@"", @"link", nil];
[FBRequestConnection startWithGraphPath:@"/me/photos" parameters:params HTTPMethod:@"POST"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { }];

享受吧!

最新更新