Chewie The Chorkie
Chewie The Chorkie

Reputation: 5234

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

Upvotes: 0

Views: 159

Answers (4)

Chewie The Chorkie
Chewie The Chorkie

Reputation: 5234

There is no casting that's needed for either tileCoord or tileKind

int blocksCollidableGID = [debugZoneLayer getGID:tileCoord withTileKind:@"blocksCollidable"];

Upvotes: 0

tamasgal
tamasgal

Reputation: 26259

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.

Upvotes: 1

kperryua
kperryua

Reputation: 10534

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.

Upvotes: 1

Kobski
Kobski

Reputation: 1636

Also the first parameter should not be an NSValue, it should be a CGPoint.

Upvotes: 1

Related Questions