cocos2d-iphone でゲームの実装を開始しました。プロジェクトで ARC を使用しています。
@interface
my で宣言されたクラスのメインでLevelfinder.h
、次のプロパティを宣言しました。
@property NSMutableArray* pineapples;
私のメインクラスでは、このプロパティを使用しています:
for (PineappleModel* pineapple in levelFileHandler.pineapples)
{
b2Body* body = [self createPineappleAt:
[CoordinateHelper levelPositionToScreenPosition:pineapple.position]];
body->SetLinearDamping(pineapple.damping);
[pineapplesDict setObject:[NSValue valueWithPointer:body]
forKey:[NSNumber numberWithInt: pineapple.id]];
}
しかし、コードを実行すると、次のランタイム エラーが表示されます。
SIGABRT '-[LevelFileHandler setPineapples:]: unrecognized selector sent to instance 0x9431c60
私は cocos2d を初めて使用しますが、この問題を長い間見ていて行き詰まっています。どんな種類の助けも大歓迎です。
ここはLevelFileHandler.h
@interface LevelFileHandler : NSObject
@property NSMutableArray* pineapples;
@end
今、LevelFileHandler.m
私のパイナップルプロパティをこのように使用しました
self.pineapples = [NSMutableArray arrayWithCapacity:5];
[self.pineapples addObject:pineappleModel]
このコードの意図は、明らかに、容量が 5 の配列を作成することです。