简体   繁体   中英

Pull data from a website into my iphone app

I basically want to make part of my iphone app display schedule within the app, my thought is to make an xml template and then edit the file on the webserver as the schedule changes, then as a user views the file the schedule will load. My question would be what the best way would be to implement this? Just call the URL? I would like to also save the XML (storage) data until user refreshes so it can be views if the device is offline and/or the webserver is down.

I'm thinking of using PhoneGap for the schedule page, would that work?

Also I'm a very new developer so I'm learning everything as I add it here.

For your first connected application, I would recommend modelling it after the Apple sample app, SeismicXML.

http://developer.apple.com/iphone/library/samplecode/SeismicXML/Introduction/Intro.html

This application does everything you want from your application except for saving the XML to disk. For this, I would recommend the following, assuming that you read the XML file in "myArray" before calling this code:

NSString *path = [[NSBundle mainBundle] pathForResource:@"myArrayAsPlistPath" ofType:@"plist"]; 

//this will create a plist (xml file with special format) in the app's main directory.
//You can easily read this plist into an array.
[theArray writeToFile:path atomically:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM