0

おそらくばかげた間違いですが、ボタンを押した後にアプリがシャットダウンする理由を知る必要があります。それは1、2秒の間望ましい答えを与え、それからシャットダウンします。なんで?それからそれは私をこれに連れて行きます:

1{
2    @autoreleasepool {
3        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
4    }
5}

3行目は緑色で網掛けされており、右側に「スレッド1:信号SIGBART」と表示されています。

これはコードです:

- (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;
4

1 に答える 1

2

実行する前に、Xcodeに例外ブレークポイントを設定してみてください。次に、実際にクラッシュを引き起こしているコード行を強調表示する必要があります。

ここに画像の説明を入力してください

ここに画像の説明を入力してください

于 2012-05-10T16:35:16.430 に答える