我只是啓動了一個新的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