使用Facebook文档中的示例代码,但它无效
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{object-id}/likes"
parameters:nil
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
它给出了
*
error = {
code = 100;
message = "(#100) The parameter url is required";
type = OAuthException;
};
};*
答案 0 :(得分:0)
Facebook为“喜欢”自定义对象提供了两种不同的实现。
1在这里:https://developers.facebook.com/docs/graph-api/reference/v2.3/object/likes#publish
和其他人在这里。 https://developers:facebook.com/docs/reference/opengraph/action-type/og.likes#create
它的第二个链接中的代码实际上有效
NSDictionary *params = @{
@"object": @"http://samples.ogp.me/226075010839791",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/me/og.likes"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];