Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

j-mods

macrumors newbie
Original poster
Feb 16, 2011
20
0
Uinted Kingdom
Hi

I want to get the exchange rate for the pound verses the dollar from the web and insert it into my convert code. This is my code and as you can see, at the moment the user has to enter the exchange rate themselves into the equation.

@implementation exchange

-(void)awakeFromNib {
[dollarsTextField setFloatValue:0.0];
[poundsTextField setFloatValue:0.0];
[exchangeRateTextField setFloatValue:0.0];
}

-(IBAction)convert: (id)sender {
if ( sender == poundsTextField ) {
float poundsPrice = [poundsTextField floatValue];
float exchangeRatePrice = [exchangeRateTextField floatValue];
[dollarsTextField setFloatValue: (poundsPrice*exchangeRatePrice)];
}
else if ( sender == dollarsTextField ) {
float dollarsPrice = [dollarsTextField floatValue];
float exchangeRatePrice = [exchangeRateTextField floatValue];
[poundsTextField setFloatValue: (dollarsPrice/exchangeRatePrice)];
}
}
@end

I want it so when the user enters how many pounds they want converted or vice versa, it will run the get info code, input that to this code then run this code, meaning that you always have an upto date exchange rate (I know this is slower than say finding it and keeping it the same until the session ends, but I really need accuracy with this).

Thanks

Julian
 
You need to buy a data feed. Market data is not free. If you ever plan to distribute this app you are going to get a correspondence from a lawyer at some point for theft.

Hi

I want to get the exchange rate for the pound verses the dollar from the web and insert it into my convert code. This is my code and as you can see, at the moment the user has to enter the exchange rate themselves into the equation.



I want it so when the user enters how many pounds they want converted or vice versa, it will run the get info code, input that to this code then run this code, meaning that you always have an upto date exchange rate (I know this is slower than say finding it and keeping it the same until the session ends, but I really need accuracy with this).

Thanks

Julian
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.