0

我想通过 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 值,但没有运气。这是游戏成就对象的文档链接 使用开放图形对象共享游戏成就

4

1 回答 1

0

这是对我有用的答案

只需将其包装在数据值中:

object[@"data"][@"game:points"] = @"100";
于 2014-10-13T12:25:17.720 回答