2011-01-15 7 views
0

私のゲームのスコアを提出するために私のアプリケーションのFacebookにアクセスしようとしています。私は自分のxcodeプロジェクトにそのAPIを含むfbに私のアプリケーションを登録しました。そして、サンプルプロジェクトを使用して、しかし、私はこのコードを使用するとき、メッセージは私の壁に掲示されていますが、すべての詳細が含まれているように含まれていますNSMutabledictionary ..私はおそらく間違っているのですか?iPhoneでFacebookにゲームスコアをアップロードしていますか?

- (IBAction)publishStream:(id)sender { 



SBJSON *jsonWriter = [[SBJSON new] autorelease]; 

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
           @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil]; 



    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
           @"a long run", @"name", 
           @"The Facebook Running app", @"caption", 
           @"it is fun", @"description", 
           @"http://itsti.me/", @"href", nil]; 


    NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           @"Share what on Facebook", @"user_message_prompt", 
           actionLinksStr, @"action_links", 
           attachmentStr, @"attachment", 
           nil]; 


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

} 

のみSHARE FACEBOOK ONメッセージは自分のアプリケーションの名前と一緒に私の壁に掲示し、私が使用する方法を見つけ出すことはできないよ休まれ...任意の助けには理解されるであろう??

答えて

4

ここには動作する修正されたPublishStream関数があります。

- (void)publishStream:(id)sender { 

    SBJSON *jsonWriter = [[SBJSON new] autorelease]; 

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
                  @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil]; 

    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
           @"a long run", @"name", 
           @"The Facebook Running app", @"caption", 
           @"it is fun", @"description", 
           @"http://itsti.me/", @"href", nil]; 
    NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @"Share on Facebook", @"user_message_prompt", 
            actionLinksStr, @"action_links", 
            attachmentStr, @"attachment", 
            [NSString stringWithFormat:@"I scored %d on mycoolgame, Think you can beat me? - http://bit.ly/cJtBkE", totalScore],@"message", 
            nil]; 

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

} 
+0

facebookダイアログの "feed"の代わりに "stream.publish" – hemant

0

私たちが@hemantで指摘したように、「stream.publish」が欠落しています。それはFacebook SDKに含まれているDemoAppには欠けているようだ。

関連する問題