Objective c 运行时错误ns无效参数异常
我是一个使用objective C进行IOS编程的新手。我没有太多经验,希望得到一些帮助 下面是描述错误的输出:2013-08-08 17:48:47.957多机[57549:c07]-[ViewController播放:]:未识别的选择器发送到实例0x7578870 2013-08-08 17:48:47.959多机[57549:c07]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[ViewController play::]:未识别的选择器发送到实例0x7578870'Objective c 运行时错误ns无效参数异常,objective-c,runtime,runtime-error,Objective C,Runtime,Runtime Error,我是一个使用objective C进行IOS编程的新手。我没有太多经验,希望得到一些帮助 下面是描述错误的输出:2013-08-08 17:48:47.957多机[57549:c07]-[ViewController播放:]:未识别的选择器发送到实例0x7578870 2013-08-08 17:48:47.959多机[57549:c07]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[ViewController play::]:未识别的选
// 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
//ViewController.h
//多机
//
//由Danny Takeuchi于2013年8月7日创作。
//版权所有(c)2013 Danny Takeuchi。版权所有。
//
#进口
NSString*问题列表[100];
@界面ViewController:UIViewController
@属性(弱,非原子)IBUIButton*播放按钮;
@性质(弱,非原子)IBUILabel*问题;
@属性(弱,非原子)IBUITEXTFIELD*答案;
-(iAction)准备:(id)发送方;
-(iAction)进程:(id)发送方;
@属性(弱,非原子)IBUIButton*检查答案;
@结束
//
//ViewController.m
//多机
//
//由Danny Takeuchi于2013年8月7日创作。
//版权所有(c)2013 Danny Takeuchi。版权所有。
//
#导入“ViewController.h”
@界面视图控制器()
@结束
@实现视图控制器
-(无效)viewDidLoad
{
[超级视图下载];
//加载视图后,通常从nib执行任何其他设置。
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
-(iAction)进程:(id)发送方{
}
-(iAction)准备:(id)发件人{
int z=0;
while(z您何时收到此错误?是在您按下播放按钮时发生的吗?您是否创建并连接了一个-(iAction)play:(id)sender;
并将其删除