iPhone Objective-C的最简单的方法来获得股票报价 [英] iPhone Objective-C Simplest Way to get a stock quote

查看:137
本文介绍了iPhone Objective-C的最简单的方法来获得股票报价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想知道是什么让一个股票的当前价格从Objective-C中对于iPhone SDK说雅虎财经(或类似)的最简单方法。

Hi guys Im wondering what is the simplest way to get the current price of a stock from say yahoo finance (or similar) in objective-C For the iPhone SDK.

简单是关键,我找了当前的价格和天数的运动。

Simple is the key, I am looking for current price, and days movement.

我还没有多少运气找到一个iPhone code例子或库。

I havent had much luck finding an iPhone code example or library.

关于

推荐答案

使用的的NSURLRequest 对象在该地址检索数据:

Use an NSURLRequest object to retrieve the data at this address:

http://download.finance.yahoo.com/d/quotes.csv?s=AAPL&f=sl1d1t1c1ohgv&e=.csv

使用 [的NSString stringWithFormat:] 到AAPL改为你想要使用的股票代码。检索的数据是CSV格式,所以你需要解析,要获得您需要的个人价值。这可以在这个简单的情况下,做到用 [NSString的componentsSeparatedByString:@,。来retieve一个数组,你可以使用两个循环解析

Using [NSString stringWithFormat:] to change the AAPL to the stock ticker you want to use. The retrieved data is in CSV format so you will need to parse that to get the individual values you require. This can be done in this simple case using [NSString componentsSeparatedByString: @","] to retieve an array which you can parse using two loops.

这篇关于iPhone Objective-C的最简单的方法来获得股票报价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆