ヘッダー ファイルが次のような Core Data エンティティがあります。
@interface MyEntity : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * index;
@end
実装ファイルは次のようになります。
@implementation MyEntity
@dynamic index;
@end
今、私は次のようなコードを持っています:
NSArray* selectedObects = [myEntityArrayController selectedObjects];
NSUInteger theIndex = [[[selectedObects objectAtIndex:0] index] unsignedIntegerValue];
「myEntityArrayController」オブジェクトは、MyEntity のすべてのエンティティを管理する NSArrayController です。このコードは正しく実行されますが、XCode は常に、コードの最後の行に対して「Invalid receiver type 'NSUInteger'」という警告を表示します。何らかの理由で、XCode はindex
メソッドが NSUInteger を返すと考えます。「objectAtIndex」はタイプ「id」のオブジェクトを返すため、なぜこれを考えるのかわかりません。
プロジェクトを数回クリーンアップしましたが、これらの警告はしばらくの間ぶらぶらしていました。任意の提案をいただければ幸いです。