Search code examples
iphoneipad

iphone snow falling effect


i have been following apps snowfall tutorial, but i am getting some issue in iOS 5, something like this enter image description here
(source: appsamuck.com)

-

 (void)onAnimationComplete:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {

    UIImageView *flakeView = context;

****this is where the issue is: implicit conversion of a non objective c pointer type 'void *' to 'UIimageview' is disallowed when using ARC

Please suggest, how can I solve this problem.

Regards

enter image description here


Solution

  • Expanding on @fluchtpunkt 's comment which should really have been an answer ;)

    ARC works by determining, at compile time, if the objects are needed or not - it then works out your retain/release for you.

    If you pass an object as (void *) the compiler cannot work out that it has to retain this object so it might get released before you use it.

    The __bridge explicitly tells the compiler that you are passing a 'real' object but using a void * to do it.

    However, there might be a risk of a memory leak if you don't tell the compiler somewhere else that you are done with the object :)

    Take a look at http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/index.html and search for '_bridge' to see more details.