I’m an inexperienced iPhone developer hoping to get a bit of insight into how to create textual application data that will be distributed with my iPhone application.
The use case is simple – I’m creating a tutorial to show the users how to use the app. There will be a set on x tutorials (chapters, if you will) each having y number of steps. Each step contains a set of strings that will get read in and converted to meaningful information. I’d like to be able to load one chapter at a time to minimize overhead. I’d really like to be able to create and edit the t开发者_运维问答ext outside of XCode (for obvious reasons). The tutorial text should install with the application and be read when the user starts the tutorial.
There are lots of options – core data, SQL Lite, NSEncoding, etc. It’s a lot to sift through. At this point I’m leaning toward NSEncoding, but it looks like I’d have to write code to create the data – some utility app and that creates the tutorial files offline. That’s not a big deal, but it just makes it hard to maintain. Plus a property list file just seems wrong. And it doesn’t seem like it should be this hard.
Anyway, I’m looking for some advice on the most pain-free way to organize and load a bunch of text strings that are created outside of the app.
I’m also confused on how to package the text files for deployment, so if you know of a good tutorial I’d appreciate the link.
Using a plist file would be a good approach to this- it would let you edit outside of Xcode and organize the data in a coherent way. Another great aspect of the plist is you could have an array of "chapters" and in that array have another array of "steps"; then when you load the plist you can search through it for which chapter and step you want. Loading the plist on the iPhone is very simple- it transitions to NSArrays or NSDictionaries very easily.
Here is a link on how to load data from the plist file onto the iPhone and here is a more in depth tutorial on creating the plist and loading it into the iPhone.
精彩评论