我正在阅读 O'Reilly 的《Learning Cocoa with Objective-C 3rd edition》一书。
O'Reilly 网站没有此特定书籍的论坛,搜索此错误不会返回任何内容。
在第 18 页,我不断收到以下错误:
"No visible @interface for 'UIAlertView' declares the selector 'initWithTitle:message:deluge:cancelButtonTitle:otherButton'"
这是我的代码:
//
// ViewController.m
// HelloCocoa
//
// Created by ME on 1/14/13.
// Copyright (c) 2013 ME. 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)showAlert:(id)sender
{
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Hello!"
message:@"Hello, World!"
delegate:nil
cancelButtonTitle:@"Close"
otherButtonTitle:nil];
[alert show];
[_helloButton setTitle:@"I was Clicked!" forState:UIControlStateNormal];
}
@end
//
// ViewController.h
// HelloCocoa
//
// Created by ME on 1/14/13.
// Copyright (c) 2013 Andrew DiNatale. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *helloButton;
- (IBAction)showAlert:(id)sender;
@end
是什么导致了这个错误?