Invalid receiver type 'NSUInteger'
- by CJ
I have a Core Data entity whose header file looks like this:
@interface MyEntity : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * index;
@end
And it's implementation file looks like this:
@implementation MyEntity
@dynamic index;
@end
Now, I have a piece of code that looks like this:
NSArray* selectedObects = [myEntityArrayController selectedObjects];
NSUInteger theIndex = [[[selectedObects objectAtIndex:0] index] unsignedIntegerValue];
The 'myEntityArrayController' object is a NSArrayController which manages all entities of MyEntity. This code executes correctly, however XCode always gives the warning "Invalid receiver type 'NSUInteger'" for the last line of code. For some reason, XCode thinks that the index method returns a NSUInteger. I'm not sure why it thinks this, because 'objectAtIndex' returns an object of type 'id'.
I've cleaned the project several times, and these warnings have hung around for a while. Any suggestions are appreciated.