Detecting a user's currency in Objective-C for iPhone SDK... where to begin?
I have an app that deals with currency, but obviously I'd like it to be multilingual. Where do I开发者_StackOverflow社区 go about finding the value of what the user's default currency is? I presume it's as easy as a line or two of code, but I may be wrong...
Jack
Have you looked at NSLocale#objectForKey:
?
[NSUserDefaults standardUserDefaults]
probably has some useful information. Try dumping that entire thing and see if you can find what you're looking for.
NSArray * domains = [[NSUserDefaults standardUserDefaults] persistentDomainNames];
for (NSString * domain in domains) {
NSDictionary * dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:domain];
NSLog(@"%@ => %@", domain, dict);
}
精彩评论