我是目标C的IOS编程的新手。我没有太多的经验,希望得到一些帮助。
以下是描述错误的输出:2013-08-08 17:48:47.957 multMachine [57549:c07] - [ViewController播放:]:无法识别的选择器发送到实例0x7578870 2013-08-08 17:48:47.959 multMachine [57549:c07] * 由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [ViewController play:]:无法识别的选择器发送到实例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
答案 0 :(得分:0)
你什么时候收到这个错误?是你按下播放按钮的时候?您是否创建并连接了-(IBAction)play:(id)sender;
并删除了它?