0

我有一个来自 Flickr api 请求的 NSDictionary 响应,它的描述如下所示:

self.userInfo: {
"_text" = "\n\n";
person =     {
    "_text" = "\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n";
    description =         {
    };
    iconfarm = 0;
    iconserver = 0;
    id = "83943196@N02";
    ispro = 0;
    location =         {
    };
    "mbox_sha1sum" =         {
        "_text" = 7b61c5d24f12345678be82c31234567830540;
    };
    mobileurl =         {
        "_text" = "http://m.flickr.com/photostream.gne?id=12345678";
    };
    nsid = "12345678@N02";
    "path_alias" = "";
    photos =         {
        "_text" = "\n\t\t\n\t\t\n\t\t\n\t\t\n\t";
        count =             {
            "_text" = 2;
        };
        firstdate =             {
            "_text" = 12345678;
        };
        firstdatetaken =             {
            "_text" = "2012-08-01 12:46:38";
        };
        views =             {
            "_text" = 0;
        };
    };
    photosurl =         {
        "_text" = "http://www.flickr.com/photos/12345678@N02/";
    };
    profileurl =         {
        "_text" = "http://www.flickr.com/people/12345678@N02/";
    };
    realname =         {
        "_text" = "Me TheUser";
    };
    timezone =         {
        label = "Pacific Time (US & Canada); Tijuana";
        offset = "-08:00";
    };
    username =         {
        "_text" = metheuser;
    };
};
stat = ok;
}

我正在弄清楚如何将实名值提取到 NSString 中。

我试过了:

NSString * temp = [self.userInfo valueForKey:@"realname"];
NSLog (@"FL: nameOfSignedInUser. nameself.userInfo: %@", temp.debugDescription);

但返回为零。

谢谢你!

4

2 回答 2

1
NSString *name = [self.userInfo valueForKeyPath:@"person.realname._text"];
于 2012-08-02T20:38:13.950 回答
0
NSString *realName = [[[self.userInfo objectForKey:@"person"] objectForKey:@"realname"] objectForKey:@"_text"];
于 2012-08-02T20:31:43.853 回答