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…
@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!!
- iOS App with Static Lib ALWAYS crashes on Launch of Ad Hoc Archive Build. Cant reproduce in Xcode Debugger
- IOS 8 Silent push notification not working without Xcode
- Calculate Total Traveled Distance iOS Swift
- Write extend file attributes swift example
- Convert hex to decimal in swift
- Lazy loading UITableView with multiple images in each cell
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;
- openURL Callback?
- Options to securely authenticate mobile access using OAuth2
- Xcode Project stuck “Compiling Swift source files”
- Autolayout resize button based on text and have textfield fill available space
- How to record internal audio from other apps using a private API iOS?
- indexPathForRowAtPoint returns nil only for first cell in a uitableview
- Implement PushKit and test in development behavior
- Ranging Beacons only works when app running?
- Telephone number format should be international,Is there any Regex for phone number validation in iPhone
- ffmpeg use on iOS
- iOS: How do I detect if music is playing in any background music app?
- Convert PinchRecognizer Objective-C code to Swift
- Determining if an iPhone is Jail broken Programmatically
- GLPaint Brush Effect with blur and bevel
- Disable Nagle's algorithm for NSOutputStream