Seeking advice for how to implement "notification" upon completion of asynchronous upload
Seeking advice for how to implement "notification" upon completion of asynchronous upload
- Subject: Seeking advice for how to implement "notification" upon completion of asynchronous upload
- From: Chris Markle <email@hidden>
- Date: Thu, 31 Mar 2011 17:08:20 -0700
Still fairly new here to iOS and Objective-C programming, so looking
for some advice to help keep me from going down the wrong road(s)... I
would like to build an Objective-C class or classes to perform a file
upload using a non-standard protocol. It would run the upload
asynchronously and would need to notify the caller upon completion. I
see a variety of techniques used or discussed for this and I was
hoping to get some advice on which pattern or patterns I should use
and which I should stay away from. I have no issue with using stuff
that only runs on the latest iOS or OS X systems, so supporting older
OS's in not a concern for me.
I see in particular:
1. delegates - e.g., NSURLConnection connection:didFailWithError: and
connectionDidFinishLoading:, or similar ones in ASIHTTPRequest
requestFinished or requestFailed
2. blocks - e.g., ASIURLRequest completionBlock or failedBlock, or
ALAssetsLibrary assetForURL:resultBlock:failureBlock: (ASIHTTPRequest
actually implements delegates and blocks and allows you to mix and
match them.)
3. KVO (key-value observation) - e.g., some service where you observe
an isFinished property
4. Notifications (NSNotificationCenter, etc.) - haven't really seen
this used much but a lot of people seem to talk about it as a good
approach
There are probably other techniques as well...
For a new, modern API which approach or approaches should I use or not
use? I suppose my main interest here is to use something that's
flexible to the programmer that uses my API, and something that is
conventional ion its approach so that the programmer is using
something normal and not unusual.
Thanks in advance for any counsel on this...
Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden