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

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -