I am making a (sort of) trading card game , using SpriteKit
. I created a Card class, and each card has a rank :
// in Card.h
@property NSInteger cardRank;
In one of my another class (Game class), i'm trying to retrieve this value. I create a Card instance, and display the value in the console (testing purpose) :
Card *tmpCard = [[Card alloc] init];
NSLog(@"%@", tmpCard.cardRank);
When I use %@ in the NSLog, I get the right value for the cardRank, but an Xcode warning saying that "Values of type nsinteger should not be used as format arguments" and that I should cast to "long".
If I cast to long… :
NSLog(@"%ld", (long)tmpCard.cardRank);
… I got no error, but not the right value for cardRank (it displays something like "140378469207968").
Could someone explain me why I got this result ?
I am probably making a rookie mistake but couldn't understand it myself in the las few days.