I have an array named "rankStrings" and I am trying to get the data from it at an index as below...
NSArray *rankStrings = @[@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10"];
return [rankStrings[self.rank] stringByAppendingString:self.suit];
the "rank" is declared as...
@property (nonatomic) NSUInteger *rank;
I get error, "Indexing expression is invalid because subscript type 'NSUInteger' is not an integral or objective c pointer type".
I tried using "NSInteger" or "int" instead of "NSUInteger", but it is still the same.
Any help is much appreciated!!
You are using a pointer to a NSUInteger
, and the array expects a NSUInteger
(primitive type) as index. Declare your property like this instead:
@property (nonatomic,assign) NSUInteger rank;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With