简体   繁体   中英

Objective-C: Assigning an Array Value as the key for a NSDictionary

I have a Property list = DictionaryofAddresses, inside which is an NSDictionary StoredAddr; The keys inside StoredAddr are Mac Addresses, and the values an array of RSI readings.

I have an array, compareAddr (which holds an array of Mac addresses) I want to use a loop, in which the value at compareaddr[i] will be used as a key, to match whether addresses in my array match any keys in my dictionary.

NSArray *compareAddr = [DiscoveredAP allKeys];

for (int i = 0; i < [compareAddr count]; i++){

NSArray *RSIatAddr = [[dictionaryOfAddresses     objectForKey:@"StoredAddr"]objectForKey:compareAddr[i]];

The following code gives me an error : expected identifier

Thank you for any help

使用[compareAddr objectAtIndex:i]而不是compareAddr[i]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM