【发布时间】:2013-04-11 20:07:53
【问题描述】:
我一直在关注这个教程: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:'
【问题讨论】:
-
您的 AppDelegate.m 是否导入 AppDelegate.h?您的 AppDelegate.m 是否有
@implementation AppDelegate行? -
@rmaddy 确实 import AppDelegate.h 我也有
@implementation AppDelegate -
显示完整的错误/警告信息。
标签: objective-c xcode ios6