Xcode“未声明标识符的使用"错误,编译/运行得很好 [英] Xcode "Use of undeclared identifier" errors, compiles/runs just fine

查看:24
本文介绍了Xcode“未声明标识符的使用"错误,编译/运行得很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常烦人的问题,阻碍了我的工作流程.在我的项目中,我到处都是未声明标识符的用户"错误.它们都参考单个类,特别是主题类.我检查了我的导入是否有任何循环引用,没有.我真的很困惑.

I've got an incredibly annoying issue that is hampering my workflow. In my project I have "User of undeclared identifier" errors all over. They are all in reference to a single class, specifically a Theme class. I checked for any circular referencing with my imports, none. I'm really confused.

这是错误的屏幕截图.我会在构建日志中发布错误以获取更多详细信息,但没有任何错误.它构建和运行得很好...

Here is a screenshot of the errors. I would post errors in the Build Log for more detail, but there aren't any. It builds and runs just fine...

我尝试清理、删除派生数据...有什么想法吗?

I've tried cleaning, deleting the derived data... Any ideas?

推荐答案

我遇到了同样的问题,并注意到所有未声明的标识符都在我的 pch 文件中的文件中声明.

I was having the same problem and noticed that all of the undeclared identifiers were declared in files that were in my pch file.

考虑到这一点,我从 pch 文件中删除了 #import 行之一并重新编译,但它按预期失败.然后我将删除的行放回原处,重新编译并正常编译,所有错误错误都消失了.

With this in mind I deleted one of the #import lines from the pch file and recompiled which failed as expected. I then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.

如果上述解决方案没有帮助,希望这个简单的解决方案可以帮助你们中的一些人.

Hopefully this simple solution helps a few of you out if the above solutions don't.

这篇关于Xcode“未声明标识符的使用"错误,编译/运行得很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆