views:

51

answers:

1

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-6783-4c59-9c60-b8fe96f2110c</uuid>
    <web-address>WWW.ACEARA.COM</web-address>
    <zip></zip>    
    <can-see-private type="boolean">false</can-see-private>
</company>
+2  A: 

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

initWithFormat:@"'url-name' like '%@'"
Georg Fritzsche