Error: Indexing expression is invalid because subscript type 'NSUInteger' is not an integral or objective c pointer type

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…

  • Move view up when keyboard is presented
  • How do I “legally” fade out the navigation bar in an app?
  • How should I choose a video format to be played on Web, Android & iOS?
  • How to Manually Symbolicate iOS Crash to View Crash Logs
  • NSLocale currency symbol, show before or after amount value
  • BSMachError on granting access to camera
  • @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!!

    Solutions Collect From Internet About “Error: Indexing expression is invalid because subscript type 'NSUInteger' is not an integral or objective c pointer type”

    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;