¿Cómo administrar, rastrear o sincronizar múltiples solicitudes asíncronas de servidores en Objective-C?

Estoy haciendo e-NewsPaper app for both iphone and ipad which supported both for iOS 6 and iOS7.

In the app , there will be 1 week of noticias to display(in 1st view) and each news contains 10 to 15 news pages y de 30 a 40 for those pages (in the 2nd view). So each news contains 10 to 15 imágenes y de 30 a 40 xml articles (i.e to be parsed and displyed in webview).

Estoy utilizando ASIHttpRequest for requesting and downloading images and xml y NSXMLParser es análisis xml. estoy usando UICollectionView for displaying News list en celdas.

No hay multiple news downloading in asynchronous way. Also user can play - pause -resume (start - stop -cancel) this downloading in between by clicking button on each cell. There will be also one progressview to indicate downloading progress on each cell.

I am doing following tasks/steps to download and display news and its articles ;

1) Call PHP webservice and parse its JSON response and get News Paper list i.e going to display in collectionview of 1st veiw.

2) On clicking of any News Paper (i.e on collectioview cell), parsing will be started for that news's xml file.

3) Then with parsing of that file, the images and xml files are going downloaded in document directory.

I am able to download single as well as multiple news (with their images and xmls) but could not be able to identify , manage or track which news's images and xmls are downloading or downloaded among multiple news due to it is asynchronous.

I need to track , identify each news's request uniquely (with its images and xmls downloading process) so that i can play-pause downloading.

I have searched a lot but could not be able to handle this.

Por favor, ayúdame...


preguntado el 27 de noviembre de 13 a las 05:11

1 Respuestas

I'v never worked with ASIHttpRequest, im used to AFNetworking. Either way, i just checked ASIHttpRequest documentation and they seem to use NSOperations just like AFNetworking for handling requests. Maybe you could map your operations with any id you have in your models. If this works for you then it will be very easy to cancel, pause, resume any operation, just looked them up where you stored them and perform tasks over them.

Espero eso ayude.

respondido 27 nov., 13:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.