ios - NSLocaleCountryCode returns nil -


i have bugreport states crash in following line, client instance of nsmutabledictionary

[client setobject:[[nslocale currentlocale] objectforkey:nslocalecountrycode] forkey:@"country"]; 

my guess is, nslocalecountrycode returns nil in line, leads adding nil object nsdictionary lead crash. question is, has experienced issue before? there reasons nslocalecountrycode nil currentlocale? documentation doesn't returning nil value , thought return valid country.

best regards, michael

there others have experienced issue, when nslocale "system locale". need more defensive in coding, either not populating key if it's nil or using [nsnull null]:

nslocale *locale = [nslocale currentlocale]; nsstring *country = [locale objectforkey:nslocalecountrycode]; if (country != nil) {     [client setobject:country forkey:@"country"]; } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -