Warnings in Objective c with method call
I think this will be pretty simply answered, I'm just stumped on how to get rid of these warnings.
I'm getting 'DebugZoneLayer' may not respond to '-getGID:tileKind' and Initialization makes integer from pointer without a cast when I开发者_开发百科 do this method call:
int blocksCollidableGID = [debugZoneLayer getGID:[NSValue valueWithCGPoint:(NSString*)tileCoord] tileKind:@"blocksCollidable"];
Which I tried all different combinations of casting those types of values.
In DebugZoneLayer.h I have:
-(int) getGID:(CGPoint)tileCoord withTileKind:(NSString*)tileKind;
Thanks
Also the first parameter should not be an NSValue, it should be a CGPoint.
septi is correct about the selector typo, but there seems to be some additional problems as well.
-valueWithCGPoint:
takes, well, aCGPoint
. The cast to(NSString *)
is incorrect. What istileCoord
?- The first parameter is declared to take a
CGPoint
, not anNSValue
, so the boxing doesn't seem necessary in the first place.
Obviously it should be withTileKind instead of tileKind.
Edit: I mean this line ;-)
int blocksCollidableGID = [debugZoneLayer getGID:[NSValue valueWithCGPoint:(NSString*)tileCoord] withTileKind:@"blocksCollidable"];
Edit:
so now you got rid of the warning. Now the compiler finds some other errors, like others already mentioned. Since you seem stuck at this point, I'll try to guess what to do.
You mentioned, that tileCoord is a CGPoint. So there is absolutely no need to cast or convert it anyway. Try this line of code:
int blocksCollidableGID = [debugZoneLayer getGID:tileCoord withTileKind:@"blocksCollidable"];
and see if there are other errors.
There is no casting that's needed for either tileCoord or tileKind
int blocksCollidableGID = [debugZoneLayer getGID:tileCoord withTileKind:@"blocksCollidable"];
精彩评论