I am trying to read the values of Root.plist key into NSArray so I can populate a table view for my App settings.
I am using the following code to retrieve the values of the key “country”:
NSArray *arrayCountry = [[NSUserDefaults standardUserDefaults] arrayForKey:@"country"];
NSLog(@"Number of items in array >>>>>> %d", arrayCountry.count);
NSLog returns:
Number of items in array >>>>>> 0
I tried the same on different keys but still get the same result.
Can anyone shed some light on this issue. Did I miss anything here?
Make sure your
arrayCountryisn’tnil. If it is,arrayCountry.countwill return zero even if it is nil.Try this: