Invalid receiver type 'NSUInteger'

Posted by CJ on Stack Overflow See other posts from Stack Overflow or by CJ
Published on 2010-05-01T23:28:44Z Indexed on 2010/05/01 23:37 UTC
Read the original article Hit count: 528

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.

© Stack Overflow or respective owner

Related posts about core-data

Related posts about nsarraycontroller