Search code examples
iphoneobjective-cioswordpressxml-rpc

How to get the display_name from the XML-RPC response in Objective C


In my iPhone app I am accessing a WordPress powered blog using XML-RPC WordPress APIs, and I am fetching the userlists through a XML-RPC method wp.getUsers connection. This is all working fine and I got the response as below (NSLog output):

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;
    },

Now I need to store only display_name in an NSArray, but I am not getting how to extract only display_name from the above XML-RPC response. How can I achieve this?


Solution

  • Assuming what you printing is NSArray of Dictionaries,

    NSLog(@"%@",[yourArray valueForKeyPath:@"display_name"])