I'm new to iPhone development, I need help.
I want to download an XML file from a server and store it locally.
我是iPhone开发的新手,我需要帮助。我想从服务器下载XML文件并将其存储在本地。
When I open my app first the time alone, it should show the network status.
Once the network is connected it should grab the XML file from the server and store it locally.
当我第一次打开我的应用程序时,它应该显示网络状态。连接网络后,它应从服务器获取XML文件并将其存储在本地。
When the network is offline, my app should use the last saved XML file.
当网络脱机时,我的应用程序应使用上次保存的XML文件。
1 个解决方案
#1
1
You are looking for too much here, your question is too broad. Here are some starting points for you:
你在这里寻找太多,你的问题太宽泛了。以下是一些起点:
Have a look at Seismic XML, official Apple example on how to download XML data from server. Once your file is downloaded, you can save it either:
1) In a database
2) Using CoreData
3) Write entire XML file directly to disk
It depends on your needs really.
On next application start, you need to check if connection is available. You can see how it is done in Reachability Apple example. If connection is available, download new file from server. If not, load the previously saved one.
看看Seismic XML,关于如何从服务器下载XML数据的官方Apple示例。下载文件后,您可以将其保存:1)在数据库中2)使用CoreData 3)将整个XML文件直接写入磁盘它实际上取决于您的需求。在下一个应用程序启动时,您需要检查连接是否可用。您可以在Reachability Apple示例中看到它是如何完成的。如果连接可用,请从服务器下载新文件。如果没有,请加载以前保存的一个。
#1
1
You are looking for too much here, your question is too broad. Here are some starting points for you:
你在这里寻找太多,你的问题太宽泛了。以下是一些起点:
Have a look at Seismic XML, official Apple example on how to download XML data from server. Once your file is downloaded, you can save it either:
1) In a database
2) Using CoreData
3) Write entire XML file directly to disk
It depends on your needs really.
On next application start, you need to check if connection is available. You can see how it is done in Reachability Apple example. If connection is available, download new file from server. If not, load the previously saved one.
看看Seismic XML,关于如何从服务器下载XML数据的官方Apple示例。下载文件后,您可以将其保存:1)在数据库中2)使用CoreData 3)将整个XML文件直接写入磁盘它实际上取决于您的需求。在下一个应用程序启动时,您需要检查连接是否可用。您可以在Reachability Apple示例中看到它是如何完成的。如果连接可用,请从服务器下载新文件。如果没有,请加载以前保存的一个。