开发者

Warnings in Objective c with method call

开发者 https://www.devze.com 2023-03-03 12:50 出处:网络
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 in

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, a CGPoint. The cast to (NSString *) is incorrect. What is tileCoord?
  • The first parameter is declared to take a CGPoint, not an NSValue, 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"];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号