我一整天都没有碰 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
我把上面代码中的错误作为注释。
我发现其他人过去也犯过类似的错误,但我没有看到适合我的情况的答案。
我的根 UIViewController 名为 ViewController。我做了什么导致这些错误突然出现?我今天所做的就是添加一个新的 ViewControler 和 xib 以在 UIPopoverController 中使用。我刚刚让弹出窗口正常工作,这种情况就开始发生。
约翰
最佳答案
您在 #import
作为该头文件的源文件行中引入了语法错误。
关于xcode - 突然出现AppDelegate.h错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15183173/