Reputation: 8006
Probably a dumb mistake, but I just need to know why my app shuts down after I press the button. It gives the desired answer for a second or two and then shuts down. Why? Then it takes me to this:
1{
2 @autoreleasepool {
3 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
4 }
5}
Line 3 is shaded in green and says "Thread 1: signal SIGBART" on the right side.
This is the code:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
//dismiss the keyboard
[textField resignFirstResponder];
return YES;
}
@synthesize go;
@synthesize start;
@synthesize calc;
@synthesize answer;
@synthesize input;
@synthesize count;
- (void)updateTipTotals
{
int fuzzy = [input.text intValue];
//handle divide by 0
if (fuzzy %3 == 0 && fuzzy % 7 == 0) {
answer.text = @"Fuzzy Ducky";
}else {
if (fuzzy% 7 == 0) {
answer.text = @"Ducky";
}
else {
if (fuzzy % 3 == 0) {
answer.text = @"Fuzzy";
}else {
answer.text = input.text;
}
}
}
}
-(IBAction)calcTouchDown:(id)sender{
[self updateTipTotals];
}
- (void)viewDidLoad
{
[super viewDidLoad];
//this informs the text fields the controller is their delegate
input.delegate = self;
start.delegate = self;
Upvotes: 0
Views: 88
Reputation: 18551
Try setting an exception breakpoint in Xcode before running. It should then highlight the line of code actually causing the crash.
Upvotes: 2