Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending 'MapAnnotation *__strong' to parameter of incompatible type 'id<MKAnnotation>'

Tags:

iphone

I am getting a warning in the below mentioned line:

[self.mapView addAnnotation:addressAnnotation];

The warning is:

Sending 'MapAnnotation *__strong' to parameter of incompatible type 'id<MKAnnotation>'

Since I referred similar kind of posts I have to mention that, the header file of this class includes <MKAnnotation> and the forward declaration of MapAnnotation class is also available.

Please suggest.

like image 324
Subi Avatar asked Dec 08 '11 12:12

Subi


1 Answers

To get rid of the warning, you have two choices:

  1. Declare the class of self (whatever that class is), in its @interface statement, to conform to the protocol.

  2. Suppress the warning by changing this:

    [self.mapView addAnnotation:addressAnnotation];

    to this:

    [self.mapView addAnnotation:(id)addressAnnotation];

like image 59
Milad Rezazadeh Avatar answered Oct 16 '22 15:10

Milad Rezazadeh