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

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

python - WindowsError: [Error 740] The requested operation requires elevation even after disabling UAC -

python - Terminate a gnome-terminal opened with subprocess -