On Mon, 07 Mar 2011 21:00:33 -0800, Chris Markle <cmar...@asperasoft.com> said:
>This is on iOS... Say I have use a method that has some kind of
>result/completion block like ALAssetsLibrary assetForURL In the
>example below, in the assetForURL result block, the JPEG
>representation of the asset is read into a buffer and the NSData form
>of that buffer is assigned to a property. I need the property to be
>set before my code continues past his point. How do I go about
>accomplishing that?

You put "my code" in the completion block. That's what a completion block *is*: 
it's where you do the stuff that depends upon this operation having completed. 
See also the docs (Preparing an Asset for Use):

> To load a value for one or more properties, you invoke 
> loadValuesAsynchronouslyForKeys:completionHandler:. *In the completion 
> handler*, you take whatever action is appropriate depending on the property's 
> status. 


And after all, as that same paragraph in the docs tells you (along with the 
subsequent example), the attempt to get the property's value might also fail. 
The only sensible place to handle all the things that can happen is the 
completion block.

Sure, this means you have to break up your procedure into steps, but block 
syntax can actually help you to clarify this. m.

--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to