Reputation: 3026
I'm playing with the mapkit and setting up some annotations. somewhere in my code I have :-
#define ANNOTATION_FIRST_TYPE 1
unsigned char annoType = ANNOTATION_FIRST_TYPE
annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:annoType ];
The last line above throws the error Implicit conversion of 'char' to 'NSString *' is disallowed with ARC
, which is fair enough, I need to explicitly change the annoType to a NSString.
But the odd thing is; if for line (3) I had the below instead :-
annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:**ANNOTATION_FIRST_TYPE**];
It compiles without error? Question is, what is the type of ANNOTATION_FIRST_TYPE?
Upvotes: 0
Views: 2107
Reputation: 523344
ANNOTATION_FIRST_TYPE is an integer. An integer can be implicitly converted to a pointer in C, but if you have enabled warnings the compiler should have warned you about this. I don't know why this isn't a compiler error, probably just an oversight.
You should define ANNOTATION_FIRST_TYPE as an NSString, e.g.
#define ANNOTATION_FIRST_TYPE @"1"
Upvotes: 1