iPhone: How do I lookup currency conversions?
I'm wanting to perform currency conversions in my iPhone app.
Putting aside the issues of number formatting or currency symbols, how do I convert from X USD to Y CAD (or similar)?
I know Google and Yahoo! have APIs which deal with this kind of thing, I just lack the k开发者_开发知识库nowledge to access it from my app.
Any code or URLs to examples would be cool.
Thanks, Dave.
http://betterexplained.com/articles/using-json-to-exchange-data/
does that help? scroll to the currency conversion stuff there where there's a datasource mentioned which returns XML. You may then use the NSXML parser to parse the results
check this one as well, looks dead simple:
http://www.exchangerate-api.com/
Thanks for the links, I was able to get the result I need with the following line:
label.text = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.exchangerate-api.com/USD/GBP/100?k=<<API KEY>>"]
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000)
error:NULL];
精彩评论