PDA

View Full Version : Object-C , try to save file for different views, but seems not working -- MACnewbie:)




nickyu
Jun 14, 2008, 01:16 AM
I am new to obj-c programming/iphone, so I am probably missing something.
I am making a simple xml feed reader, which has AppDelegate, ListViewController, DetailViewController (other parts are not important so left out for simplicity).
- AppDelegate gets the XML from a URL, Parse the content into an NSMutableArray. WriteToFile.
- ListViewController recover the array using dataWithContentOfFile, populate the list view
- When use click on a item, then it brings to detail view.
DetailViewController recover the array using dataWithContentOfFile, get the selected Data, display.

What I could not figure out is that: the data can not be recovered from ListViewController, or DetailViewController, or maybe it didn't get saved at the first place. Since it is running with iphone simulator, I don't know if there is anyway to check if the file being created at the first place.

Thanks in advance



HawaiiMacAddict
Jun 14, 2008, 03:01 AM
Aloha nickyu,

I'm just starting out myself with Obj-C and Xcode. As such, I haven't attempted an iPhone app, but one thing I do with the apps I've written thus far is to use the Console and insert NSLog statements to indicate success (or lack thereof) of certain parts of my code. I don't know if that option is available to you, but if so, you could use the log to indicate whether or not the data has been saved.

HawaiiMacAddict

nickyu
Jun 16, 2008, 10:05 AM
Thanks for the NSLog hint. I will check that out tonight :)