如何解决如何用json发布
| 您好,我想为字典设置以下关键值{
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;
}
);
};
我要贴comments ={ data ={ id =,name = }}
我为此使用了以下代码
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);
但这不起作用....我如何在评论对象中发布消息
解决方法
请检查以下代码:
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];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。