ios – 已知的未知类型名称?

ios – 已知的未知类型名称?,第1张

概述Xcode突然出现了这个错误:“未知类型名称” 我会解释一下: 我的StoriesViewController.h: #import <UIKit/UIKit.h>#import "Stories.h"@interface StoriesViewController : UIViewController <UITextViewDelegate>@property (strong) St Xcode突然出现了这个错误:“未知的类型名称”

我会解释一下:
我的StorIEsVIEwController.h:

#import <UIKit/UIKit.h>#import "StorIEs.h"@interface StorIEsVIEwController : UIVIEwController <UITextVIEwDelegate>@property (strong) StorIEs *story; //Here it goes- "UnkNown type name `StorIEs`"@property (weak) IBOutlet UITextVIEw *storyVIEw;@end

在我的StorIEs.h中:

#import <UIKit/UIKit.h>#import "VIEwController.h"@interface StorIEs : UI@R_419_4617@@property (strong) Nsstring * storyContent;@end

突然之间,突然之间.

提前致谢.

编辑:

在我的VIEwController.h中:

#import <UIKit/UIKit.h>#import "StorIEs.h"#import "StorIEsVIEwController.h"#import "StorIEsPickerVIEwController.h"#import <QuartzCore/QuartzCore.h>@interface VIEwController : UIVIEwController <UITextFIEldDelegate,UIAlertVIEwDelegate> {}@end

NB @class会引发大量的ARC问题.

我已经删除了对VIEwController.h的无用引用.
解决了!

解决方法 你有一个 circular reference的问题.

发生了什么事情,当你加载你的VIEwController它通过它的导入,它加载StorIEs.h,它去加载它的导入,它返回到VIEwController.h,所以你陷入无限循环.

删除其中一个冲突的导入,或使用forward class declaration(该示例适用于C,有关Objective-C的示例,请参阅here)

总结

以上是内存溢出为你收集整理的ios – 已知的未知类型名称?全部内容,希望文章能够帮你解决ios – 已知的未知类型名称?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1033925.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存