我是Xcode的新手,我似乎無法使其工作......當我構建它時代碼中沒有錯誤,但是當我按下鏈接到下面代碼的按鈕時整個應用程序崩潰應用程序在Objective-C中崩潰
step
當前是int
。
Xcode是否因此行而崩潰? if (*step == 1 || *step == 2){
這裏是我的代碼:
-(IBAction)PressOne{
if (*step == 1 || *step == 2){
if ([txtAns.text isEqualToString:@"0"])
txtAns.text = @"1";
else if (![txtAns.text isEqualToString:@"0"])
txtAns.text = [@"1" stringByAppendingString:txtAns.text];
}
else {
txtAns.text = @"1";
*step = 1;
}
}
你怎麼聲明一步?如果你int步驟; ...你可以通過刪除*步驟並用步驟替換來修復代碼。 –