On 27 nov 2010, at 06.33, Philip Vallone wrote:

>               if ((self = [[MKPinAnnotationView alloc] 
> initWithAnnotation:annotation reuseIdentifier:reuseIdentifier])) {
>                       [self 
> performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber 
> numberWithBool:YES]];
>               }


You're replacing the current instance with a new instance here. Is that 
intended? While not illegal, it is really unusual to do that.

If that's intended, you also would have to release the old instance before 
replacing it with the new instance (that's the leak). If that was not intended, 
you probably should be calling [super initWithAnnotation:annotation 
reuseIdentifier:reuseIdentifier], and in any case, you need to make sure that 
you *always* call through to the designated initializer of your superclass 
somewhere in your init method.

Finally, why are you calling a method using "-performSelector:withObject:" 
here? That seems like a trick to "fix" a compiler warning? If so, you should 
think about why the compiler were warning you about that call, and fix it 
properly - by adding the required #import statement, by adding the missing 
method declaration to the header, or - if all else fails - by casting the 
receiver to the appropriate type.


j o a r


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to