0

ゲームを作成しているときにスコアを追加できるようにしたいので、fbに投稿すると、そこにハイスコアが表示されます(社会的側面をもう少し追加するため)

これが私が訴えているコードですが、機能していないようで、アプリがクラッシュします、

- (void)fbDidLogin {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
    [defaults synchronize];
    [self postwall];

}
- (void)postwall
{
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   //kAppId, @"app_id",
                                   @"https://developers.facebook.com/docs/reference/dialogs/", @"link",
                                   @"http://fbrell.com/f8.jpg", @"picture",
                                   @"Watch Ma Balls", @"name",
                                   @"How long can you keep out of the way of ma balls for", @"caption",
                                   @"I reached a score of i% can you beat me!.",highscore, @"description",
                                   nil];

    [facebook dialog:@"feed" andParams:params andDelegate:self];
}

コードは、

高得点

そこの

文字列に追加して表示する方法はありますか?

4

1 に答える 1

2

これを試してください(と仮定しhighscoreint):

NSString *string = @"I reached a score of ";
string = [string stringByAppendingString:[NSString stringWithFormat:@"%d", highscore]];
string = [string stringByAppendingString:@" can you beat me?"];

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   //kAppId, @"app_id",
                                   @"https://developers.facebook.com/docs/reference/dialogs/", @"link",
                                   @"http://fbrell.com/f8.jpg", @"picture",
                                   @"Watch Ma Balls", @"name",
                                   @"How long can you keep out of the way of ma balls for", @"caption",
                                   string, @"description",
                                   nil];
于 2012-06-26T19:40:03.247 に答える