嗨,我碰见ExC_BAD的 适应在我的代码,
I m trying to run a method in class PurchaseTowerMenuLayer, method is from class UnitDatabase:
购买MenuLayer.m:
delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
// getUnitDatabase returns UnitDatabase class from GameScene class
[[[delegate getGameScene] getUnitDatabase] createUnit:@"t01"]; //EXC_BAD_ACCESS happens here
UnitedDatabase.m: 单位数据库: m:
-(void)createUnit:(NSString *)unitID
{
typeString = [unitID substringWithRange:NSMakeRange(0,1)];
numberString = [unitID substringWithRange:NSMakeRange(1,2)];
Unit *unit;
if(unitID == @"t00")
[unit setUnitID:unitID];
etc...
}
我在做什么才能弄出这个错误?
提前感谢!