我只是启动了一个新的XCode项目。我在迄今为止添加的代码是这样的:EXC_BAD_ACCESS错误
.H
@interface GameScreen : UIViewController {
IBOutlet UIImageView *pimple;
IBOutlet UILabel *label;
}
@property (nonatomic, retain) UIImageView *pimple;
-(void)checkcollision;
.M
@synthesize pimple;
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [[event allTouches] anyObject];
pimple.center = [myTouch locationInView:self.view];
[self checkcollision];
}
- (void)checkcollision {
if (label.text = @"0") {
label.text += 1;
}
}
我调试控制台只有最高审计机关一行:
程序接收到的信号:“ EXC_BAD_ACCESS”。 杀
请帮助
虚空应该是 - (无效)我不知道为什么会发生,当我在 – user722566 2011-05-28 08:53:55
复制代码在if语句中,您可能的意思是使用==,而不是= – oefe 2011-05-28 08:58:26
投票结束。我们变成了DebugMyCode.stackexchange吗? – Abizern 2011-05-28 10:52:06