views:

55

answers:

2

Hi. i am a noob in xcode. I am developing an iphone app where i need to send and receive data from a web service. And i need to store them temporarily in my app. i dont want to use sqlite. so i was wondering if i should use core data for this purpose. I read some articles but i still dont have a clear picture of how to do it, coz i have used core data only with sqlite. I want to do the following things :

  1. Will receive table data from a web service.
  2. Have to perform certain calculations on those fields.
  3. Will send the data back in xml format to the server.

How do i convert the xml data into int, date or any other data type? and how do i store it in managed data objects? Can anyone please help me with this??? thnx for your time.

+2  A: 

You want to use an XML parser to turn the XML into other objects; I tend to recommend TouchXML for that.

You can use Core Data and an in memory store if you are not going to save the data as it will then create and manage all of the data objects for you and generally give you less code to write. However that depends on your app if it is worth it or not. Personally i use Core Data in every app that works with data.

As for sending data, you can use the same library that you used to consume the XML to produce XML. Most of them now days are bi-directional.

Marcus S. Zarra
hey thnx marcus. i thnk this will help me a lot
Jayshree
A: 

For a specific example of fetching XML from server and then storing on the device using core data take a look at Björn Sållarp's blog post on Core Data and UITableView. A drill-down application. Note this example makes use of NSXMLParser and not TouchXML.

I have also found [coredatalibrary xcode template][2] to be quite useful in getting started with a new Core Data project.

Also if you are adding custom logic to your managed objects take a look at rentzch's [mogenerator][3] which generates 2 classes _MyEntity and its subclass MyEntity.

Vineet Bhatia