0

我是一个关于目标 C 的 IOS 编程的新手。我没有太多经验,希望得到一些帮助。

这是描述错误的输出:2013-08-08 17:48:47.957 multMachine[57549:c07] -[ViewController play:]: unrecognized selector sent to instance 0x7578870 2013-08-08 17:48:47.959 multMachine[57549 :c07] *由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因:'-[ViewController play:]: unrecognized selector sent to instance 0x7578870'

//  ViewController.h
//  multMachine
//
//  Created by Danny Takeuchi on 8/7/13.
//  Copyright (c) 2013 Danny Takeuchi. All rights reserved.
//

#import <UIKit/UIKit.h>
NSString *questionList[100];
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIButton *playButton;
@property (weak, nonatomic) IBOutlet UILabel *question;
@property (weak, nonatomic) IBOutlet UITextField *answer;
- (IBAction)prepareQuestion:(id)sender;
- (IBAction)process:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *checkAnswer;

@end







//
//  ViewController.m
//  multMachine
//
//  Created by Danny Takeuchi on 8/7/13.
//  Copyright (c) 2013 Danny Takeuchi. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)process:(id)sender {

}
- (IBAction)prepareQuestion:(id)sender {
    int z=0;
    while(z<=100){
        for(int x=1;x<=10;x++){
            for(int y=1;y<=10;y++){
                questionList[z]=[[[NSString stringWithFormat:@"%d",x] stringByAppendingString:@"*"] stringByAppendingString:[NSString stringWithFormat:@"%d",y]];
            }
        }
    }
    [_question setText:questionList[random()%100]];
}
@end
4

1 回答 1

0

你什么时候收到这个错误?是按播放键的时候吗?您是否创建并连接了 a-(IBAction)play:(id)sender; 并删除了它?

于 2013-08-10T02:13:01.310 回答