I have an iPhone application , which is consuming a Soap web service. When am sending a URLrequest, the application is getting slow.My application is a TabBarApplication.From a started calling web-service to parsing the received data, i can't select Tabs in UITabbarcontroller. How to speed my iPhone app Tabbarcontroller to get selected even when application receiving some data from web-service ? Is the use of NSThread is a good solution ?
+3
A:
Whenever you access the network, do it asynchronously, either by using a separate thread or by using asynchronous NSURLConnection instances. That way, the UI remains reponsive.
This doesn't come for free: All your views will need to manage state because they at first are in the "data loading" state (when they have submitted a request) and then, when the data last piece of data has arrived, they go into the "data loaded" state and need to be refreshed. If the reqeust fails, they go into the "loading failed" state and present a "Retry" button (or something similar).
I've written an application that gets all it's data from a remote web service. It's feels very fast and responsive, probably due to the following facts:
- It loads all data asynchronously (with NSURLConnection instances).
- It uses JSON instead of SOAP because it's more compact and quicker to parse.
- It ueses compression on the HTTP connection.
- It only loads as few data as possible on each request.
Codo
2010-09-07 08:30:52