在我的iPhone应用程序中,我使用 XML-RPC wordpress API 访问wordpress的博客,我通过XML-RPC方法获取用户列表wp.getUsers
连接工作正常我得到如下所示的休息(NSLog
输出)
2012-07-24 11:13:19.317 projectABC[1465:207] (
{
"display_name" = "Ravi Interior Design";
email = "info@xyz.com";
nicename = abiqsd;
registered = "2012-05-11 11:58:52 +0000";
"user_id" = 15;
username = abssid;
},
{
"display_name" = "qqHeuer";
email = "aheuer@xyz.com";
nicename = adamhequer;
registered = "2012-05-18 15:59:30 +0000";
"user_id" = 44;
username = adamhequer;
},
{
"display_name" = "Asdasm Rseyses";
email = "xyz@abc.net";
nicename = adaqmraeyes;
registered = "2012-06-02 18:51:06 +0000";
"user_id" = 160;
username = adaqmreyeqs;
},
现在我只需要在NSArray中存储 display_name ,但我不知道如何从上面的XML-RPC respose中仅提取 display_name ,可以任何人帮忙我提前,请提前
答案 0 :(得分:1)
假设您打印的是NSArray of Dictionaries,
NSLog(@"%@",[yourArray valueForKeyPath:@"display_name"])
答案 1 :(得分:0)
对于字典数组。
int i;
NSMutableArray *display_name = [[NSMutableArray alloc] init];
for(i=0;i<[Arr count];++i)
{
[display_name addobject:[[Arr objectAtIndex:i] valueForKey:@"display_name"]];
NSLog(@"%@", [[Arr objectAtIndex:i] valueForKey:@"display_name"]);
}