开发者

how to post with json

Hello I want to set following key Values for Dictionary

{
        application =         {
            id = 136664723060869;开发者_运维百科
            name = Iphoneapp;
        };
        caption = "bit.ly";
        comments =         {
            count = 2;
            data =             (
                                {
                    "created_time" = "2011-06-14T07:39:45+0000";
                    from =                     {
                        id = 100001507678574;
                        name = "Widevision Dev";
                    };
                    id = "100001507678574_164163733643881_1822049";
                    likes = 1;
                    message = hi;
                },
                                {
                    "created_time" = "2011-06-14T08:17:31+0000";
                    from =                     {
                        id = 100001507678574;
                        name = "Widevision Dev";
                    };
                    id = "100001507678574_164163733643881_1822143";
                    message = hmmm;
                }
            );
        };

I want to post comments ={ data ={ id = , name = }}

I used following code for this

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];

[variables setObject:@"Good Afternoon" forKey:@"message"];


NSLog(@"%@",variables);

FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"id/comments" withPostVars:variables];
NSLog(@"postMeFeedButtonPressed:  %@", fb_graph_response.htmlResponse);

But this not working....How can I post message in comment object


Please check the code below:

NSMutableDictionary *comments = [[NSMutableDictionary alloc] init];
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
NSMutableDictionary *from = [[NSMutableDictionary alloc] init];

[from setObject:@"100001507678574" forKey:@"id"];
[from setObject:@"Widevision Dev" forKey:@"name"];

[data setObject:from forKey:@"from"];


[comments setObject:data forKey:@"comments"];


NSLog(@"%@",comments);

FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"id/comments" withPostVars:comments];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜