【发布时间】:2013-03-03 06:44:07
【问题描述】:
我一整天都没有碰过 AppDelegate.h 文件,突然出现 3 个错误...
// AppDelegate.h
#import <UIKit/UIKit.h> //!Expected selector for Objective-C method
//!Expected method body
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController; //!Unknown type name "ViewController" did you mean "UIViewController?
@end
我把上面代码中的错误作为cmets。
我看到其他人过去也遇到过类似的错误,但我没有看到对我的情况有意义的答案。
我的根 UIViewController 被命名为 ViewController。我做了什么导致这些错误突然出现?我今天所做的只是添加一个新的 ViewControler 和 xib 以在 UIPopoverController 中使用。我刚刚让弹出框正常工作,这开始发生了。
约翰
【问题讨论】:
-
发布
#import该文件的文件代码。重要的是导入前的行,而不是整个文件。 -
这么简单!!!! main.m 在第一行的 // 之前插入了一个 + 字符。请发布答案,以便我给你信用。试着想想我怎么可能不小心把它放在那里。我从不去 main.m 文件,如果我知道为什么我会按 + 键。
-
好的。我想你只是不小心敲了一把钥匙——我以前做过很多次。
标签: xcode compiler-errors appdelegate