0

我一直在关注本教程: http: //www.appcoda.com/hello-world-build-your-first-iphone-app/

尝试创建一个简单的 iOS 6 应用程序。

但是我收到一个错误:@interface for 'UIAlertView'...

我有:

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

-(IBAction)showMessage;

@end

在我的AppDelegate.h文件和

-(IBAction)showMessage
{
    UIAlertView *helloWorldAlert = [[UIAlertView alloc]initWithTitle:@"my first app" message:@"hello there world!" delagate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil];
    [helloWorldAlert show];
}

@end

在我的AppDelegate.m档案中

我似乎不明白错误表示什么,我尝试了谷歌搜索,但没有更接近找到解决方案,所以我在这里错过了什么?我必须解决什么问题?

确切的错误信息:

No visible @interface for 'UIAlertView' declares the selector 'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:'
4

1 回答 1

3

这一行有一个错字:

UIAlertView *helloWorldAlert = [[UIAlertView alloc]initWithTitle:@"my first app" message:@"hello there world!" delagate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil];

替换delagatedelegate

于 2013-04-11T20:18:33.250 回答