现在的位置: 首页 > 综合 > 正文

iPhone开发–警告Receiver ‘ClassName’ is a forward class and corresponding @interface may not exist

2018年08月06日 ⁄ 综合 ⁄ 共 558字 ⁄ 字号 评论关闭

今天上午重构代码的时候出现了如下的警告:

Receiver
'ClassName' is a forward class and corresponding @interface may not exist

查看代码,也并无错误啊,编译结果也正常,思考无果,只好求救网络,在stackoverflow上找到了答案:

原因可能是你在.h文件中包含@classs yourclass.h,但是你并未在yourclass.m文件中包含#import "yourclass.h"
英文为:Maybe
you have @class
UIPickerTable
 in your .h file and you did not have #import
UIPickerTable.h
 on your {RootViewController}.m file

呵呵,原因竟是我没包含头文件,呵呵,真是大意。编译器太“智能”了,直接编译成功,运行正常,但是提示的警告令人费解,有时我真希望编译器能准确提示错误在哪,而不是自动给我纠错,让我错的稀里糊涂。
摘录自:http://stackoverflow.com/questions/620661/receiver-classname-is-a-forward-class-and-corresponding-interface-may-not-exi

抱歉!评论已关闭.