Reputation: 77
my app is based on data, that I get from the web, in XML. I implemented the NSXMLParser, and it works really good. the only (major) problem, is that the launch of the app takes about 25 seconds!!! (the parser needs to parse 30 objects, each object has 5-7 elements- all are url's/strings). so, it takes long time to start/end element, parse it, insert it to the right array, and so on...
Does parsing with Gdata or other api/object will take less time?
Upvotes: 0
Views: 162
Reputation: 318874
Downloading data from the Internet, on the main thread, when launching the app is VERY BAD. If a user has a slow (or no) connection, iOS will actually kill the app before it finishes because it is taking too long to respond.
You must launch your app very quickly and show the user the initial view without any delay.
In your case, show a mostly empty view indicating that it is accessing data. Then start the file download and processing in the background. When the data is processed, then update the main view on the main thread allowing the user to continue.
You should also consider supplying the app with some initial default data so you app is usable and useful even if the user can't connect to the Internet. This default data could also be whatever was downloaded the last time the app was used.
Upvotes: 1
Reputation: 1359
Parsing on the background thread will make your app more responsive.
Upvotes: 0