找不到我的 IOS 视图控制器的接口声明
我收到此错误:“找不到“ViewController”超类“BaseViewController”的接口声明。情况如下:
AppDelegate:
- NSObject 的子类
在头文件中:
#include UIApplicationDelegate
BaseViewController
- UIViewController 的子类
在头文件中:
#import "AppDelegate.h"
ViewController
BaseViewController 的子类
#import "BaseViewController.h"
该错误没有意义,因为 BaseViewController
被导入到 ViewController
的头文件中。这里有什么问题呢?
I'm getting this error: "Cannot find interface declaration for 'BaseViewController', superclass of 'ViewController'. Here's the situation:
AppDelegate:
- Subclass of NSObject
In the header file:
#include UIApplicationDelegate
BaseViewController
- Subclass of UIViewController
In the header file:
#import "AppDelegate.h"
ViewController
Subclass of BaseViewController
#import "BaseViewController.h"
The error doesn't make sense, as BaseViewController
is imported in ViewController
's header file. What is the problem here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
还要检查导入语句中的无限循环
Also check for infinite loops in your import statements
尝试添加
Try adding
无法找到“BaseViewController”的接口声明
该错误意味着编译器找不到如下所示的行:
@interface BaseViewController : UIViewController
但我认为它可以找到 BaseViewController.h (或者它会具体抱怨这一点)
我检查拼写是否相同,包括大写/小写?
除此之外,它应该按您的预期工作。
Cannot find interface declaration for 'BaseViewController'
That error means that the compiler can't find the line that looks like this:
@interface BaseViewController : UIViewController
But I think it CAN find the BaseViewController.h (Or it would complain about that specifically)
I'd check that the spelling is the same including upper/lowercase?
Other than that, it should work as you'd expect.