0

我的代码中有 IBAction 的问题。每次我单击按钮时,都会出现此异常:

2013-01-15 22:25:00.798 FitnessApp[3478:c07] -[__NSCFString cancel:]: unrecognized     selector sent to instance 0x93a7e50
2013-01-15 22:25:00.800 FitnessApp[3478:c07] *** Terminating app due to uncaught exception     'NSInvalidArgumentException', reason: '-[__NSCFString cancel:]: unrecognized selector sent to    instance 0x93a7e50'

我已经搜索过这个错误。但是stackoverflow上的解决方案不起作用。我的连接都设置正确。没有重复的连接或类似的东西。

我的代码:

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setTitle:NSLocalizedString(@"Placeholder_Description", nil)];
    [self.navigationController setToolbarHidden:NO];
    [self.navigationController.toolbar setTintColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:1]];
    [self.buttonCancel setTarget:NSLocalizedString(@"Cancel_Button", nil)];
    [self.buttonSave setTarget:NSLocalizedString(@"Save_Button", nil)];
    [self.textViewDescription.layer setBorderColor:[[UIColor grayColor] CGColor]];
    [self.textViewDescription.layer setBorderWidth:1.0];
    [self.textViewDescription.layer setCornerRadius:8.0f];
    [self.textViewDescription.layer setMasksToBounds:YES];
    [self.textViewDescription setText:[self textViewDescriptionText]];
}

- (IBAction)cancel:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)save:(id)sender {
    [self.delegate doSaveDescription:self withDescription:[self.textViewDescription text]];

    [self dismissViewControllerAnimated:YES completion:nil];
}

我做了一些 NSLogs 来发现 IBAction 是问题所在,因为单击按钮后从来没有输出,只是例外。那么,如果连接设置正确,我该怎么办?

4

0 回答 0