开发者

hyphen in NSDictionary key

I've been working this for a few days now with no luck.. I am trying to parse a collection of key/value pairs from an NSDicitonary but it seems to be very sensitive to a hyphen in the key name. Below is an example of the data.. If I try to access any of the fields with a hyphen using the code below I get the following error:

unrecognized selector sent to instance

Any suggestions?

NSString *param = [[NSString alloc] initWithFormat:@" url-name like %@",url ];   
NSPredicate *predicate = [NSPredicate predicateWithFormat:param]; 
NSArray *results = [aCompanies filteredArrayUsingPredicate:predicate];

<company>
    <address-one></address-one>
    <address-two></address-two>   
    <city></city>
    <country></country>
    <id type="integer">11899</id>
    <name>Aceara</name>
    <phone-number-fax></phone-number-fax>
    <phone-number-office></phone-number-office>
    <state></state>
    <time-zone-id>Central Time (US &amp; Canada)</time-zone-id>
    <url-name>ACEARA</url-name>
    <uuid>7cc52da5-678开发者_如何学Python3-4c59-9c60-b8fe96f2110c</uuid>
    <web-address>WWW.ACEARA.COM</web-address>
    <zip></zip>    
    <can-see-private type="boolean">false</can-see-private>
</company>


Surround strings with quotes to avoid problems, e.g.:

initWithFormat:@"'url-name' like '%@'"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜