Importing 100MB XML file into my iPad application
I've a 100MB xml file in which I've stored some data and I want to use these data in my iPhone app.
What's the most efficient way to store them into my iPad application ? Should I use Core Data and create a data model or should I just store the xml file ?
If the best solution is to import the xml file into a data model, how can I do it ? Should I run some objective code from my app once (just f开发者_如何学Cor importing it) ? I need some guidelines..
thanks
The main problem in storing this file, is that you'll need to package it into your application. If you store it in core data, you'll need to bundle the db within your app.
Depending how much you need to access the data stored in your XML, you could probably create some kind of "XMLReader", but at this point, this may be easier to use CoreData so you can work with NSManagedObject in your application.
In both cases (reading directly from XML/store in core data) you need to parse your XML file and in result you'll have an array of dictionnaries or objects. Parsing an XML file each time you need some elements in it can be memory and process consuming.
So I recommand: create a 3rd party app that will generate a DB file from your XML based on your data model.
Bundle this db file in your final application, and work with NSManagedObject
精彩评论