Reputation: 1044
setCompletionHandler
method from NSAnimationContext
is not working for me. I am using code form Apple's documentation:
[NSAnimationContext setCompletionHandler:^{
// This block will be invoked when all of the animations
// started below have completed or been cancelled.
NSLog(@"All done!");
And I have the following error: No known class method for selector 'setCompletionHandler:'
When I look into NSAnimationContext.h
file next to this method there is #if NS_BLOCKS_AVAILABLE
and NS_AVAILABLE_MAC(10_7)
. My deployment target is "10.7", however I do not know how can I check if NSBlocks
are available. Or maybe the problem lies in other thing?
Upvotes: 1
Views: 291
Reputation: 90551
The example code in the documentation has an error. The -setCompletionHandler:
method is an instance method, not a class method. You need to invoke it on [NSAnimationContext currentContext]
, not on the class itself:
[[NSAnimationContext currentContext] setCompletionHandler:^{
// This block will be invoked when all of the animations
// started below have completed or been cancelled.
NSLog(@"All done!");
}];
Upvotes: 2