我想通过Open Graph与Facebook分享游戏成就故事 这是创建开放图形对象的代码
NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object.provisionedForPost = YES;
object[@"title"] = @"Playing";
object[@"type"] = @"game.achievement";
object[@"description"] = @"I just hit 1000 km";
object[@"url"] = @"https://www.facebook.com/";
object[@"image"] = @[@{@"url": [result objectForKey:@"uri"], @"user_generated" : @"false" }];
object[@"game:points"] = @"100";
[FBRequestConnection
startForPostOpenGraphObject:object
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {}];
我收到此错误消息
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)"
这是响应主体
body = {
error = {
code = 100;
message = "(#100) Object Missing a Required Value: Object at URL 'https://www.facebook.com/' of type 'game.achievement' is invalid because a required property 'game:points' of type 'integer' was not provided.";
type = OAuthException;
};
};
code = 400;
我知道错误是自解释的,但我怎样才能将整数值传递给字典。我也尝试传递NSNumber值,但没有运气。 这是游戏成就对象的文档链接 Sharing game achievement using open graph object