I am new to Xcode and I can’t seem to make it work… there is no error in the code when I built it but when I press the button linked to the code below the whole app crashes
step is currently an int.
Does Xcode crash because of this line? if (*step == 1 || *step == 2){
Here is my code:
-(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;
}
}
Since step is int, you should reference its value using step, not *step.