iphone download several files -


In my app I need to download many Plist I UIAlertView

/ code> to use NSURL connection /

to use, then when the download is over, then I Add a button for warning to dismiss it.

plist to download I adresse to use a Ansuarel somewhere in your code where the plist, next I have a NSURLRequest url Use cache policy and timeout interval. Then I can set NSMutableData with NSURL connection to NSURLRequest . In the delegate didReiveiveData : I add data to my ineligible data object, didFailWithError: I handle the error. And connectionDidFinish Loading in the final I do serial to a plaque on your data, so I can write to write your Plast and I can continue my warning.

My problem is how can I download if I have a seismitt file to download because connectionDidFinish is loading is called every time when my < is code> NSURLConnection finished but I want my UiAlert should be issued when all over but when connectionDidFinish Loading If the download is done in then the fire goes.

This is my code:

was loaded in this view:

  // Loaded the ULTRA in this view, load Was done NSURL * theUrl = [NSURL URLWithString: @ "http://adress.com/plist/myPlist.plist"]; NSURLRequest * theRequest = [NSURLRequest requestHeath URL: theUrl Cash Policy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 60.0]; Self.plistConnection = [[NSURLConnection alloc] initwithRequest: theRequest Representative: Self-initialization required: Yes]; // plistConnection is an NSURL connection - (zero) connection: (NSURLConnection *) connection was receipt data: (NSData *) data {[IncomingPListData appendData: data]; } - (void) connection: (NSURLConnection *) connectionDidFailWithError: (NSError *) error {// Handle error here} - (void) connectionDidFinisloading: (NSURLConnection *) connection {NSPropertyListFormat format; NSString * serialErrorString; NSData * plist = [NSPropertyListSerialisation propertyListFromData: Upcoming Piltadeta Priwartnshiltaopsn: Anspiproprtilist Imprutebl Format: & amp; Format Error Discription: and Serial Arstring]; If (serialErrorString) {// error} else {// create path and write to plist} // Change message and title of alert  

So if I want to download another file Where do I keep the connection request and when all my files are downloaded then how can I tell didFinish loading to fire the code?

You can repeat with an array of resources that you can download, And assign a request for each of them It is possible to set a tag for the connection (eg the index of the URL in the array) that you can evaluate in connectionDidFinish loading. If you keep information, the requests are sent and which are expired, then you can easily see if all the files have been loaded.


Comments