私はちょうどエロスを捨ててしまったので、今度は自分のコードがうまくコンパイルされますが、私が作ったcreateEntityメソッドでは常にクラッシュします。一見間違っていることはありませんが、誰かが私を助けてくれますか?提案するものは何ですか?エラーが一見無くなったところでクラッシュする
-(void)createEntityWithX:(int)newEntityX andY:(int)newEntityY withType:(int)newEntityType withWidth:(int)newEntityWidth andLength:(int)newEntityLength atSpeed:(int)newEntitySpeed
{
Entity tmpEntity;
tmpEntity.entityX = newEntityX;
tmpEntity.entityY = newEntityY;
tmpEntity.entityLength = newEntityLength;
tmpEntity.entityWidth = newEntityWidth;
tmpEntity.entityType = newEntityType;
tmpEntity.entitySpeed = newEntitySpeed;
int arrayAmount = [entityArray count];
NSValue *tmp = [NSValue valueWithBytes:&tmpEntity objCType:@encode(struct Entity)];
[entityArray insertObject:tmp atIndex:arrayAmount];
[tmp release];
}
あなたがトラブルの原因となっている行を参照して、デバッグしていますか? – Anila
int arrayAmount = [entityArray count]; NSValue * tmp = [NSValue valueWithBytes:&tmpEntity objCType:@encode(struct Entity)]; [entityArray insertObject:tmp atIndex:arrayAmount];これらのうちの1つ...コンパイルは正常ですが、このメソッドが – DuskFall
と呼ばれ、クラッシュメッセージが表示されるとクラッシュしますか? – Anila