Xcode显示许多错误,但是程序可以编译并正常运行(在模拟器和设备中) [英] Xcode shows many errors but program compiles and runs fine (in both simulator and device)

查看:160
本文介绍了Xcode显示许多错误,但是程序可以编译并正常运行(在模拟器和设备中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装CocoaLumberjack的日志压缩器类之后,我一直在得到这种讨厌的行为:Xcode抱怨有很多未声明的标识符,并给了我很多错误(不是警告,而是带有红色图标的错误)。

After installing the CocoaLumberjack' log compressor class I've been getting this annoying behavior: Xcode complains that there are many undeclared identifiers and gives me many errors (not warnings but errors with the red icon).

问题是我可以很好地编译和运行iPad应用程序,但Xcode不会自动完成。我尝试清理构建文件夹(产品> 选项 +清理),还删除了派生数据。我也没有重新启动。

The thing is that I can compile and run my iPad app just fine but Xcode won't do any autocompletion. I tried cleaning the build folder (Product > option + Clean), and also deleting derived data. I've also rebooted to no avail.

您可以想象这是一个痛苦的工作。在以前的Xcode版本中,确实发生过这种情况。它与我预编译的头文件中的内容有关,但是使用上述解决方案将始终对其进行修复。我当前正在使用Xcode 4.4(4F250)。

As you can imagine this is a pain to work with. I did have this behavior happen before on a previous version of Xcode; it had something to do with stuff in my precompiled headers file but using the solution above would always fix it. I'm currently using Xcode 4.4 (4F250).

出现示例错误:

语义错误:使用未声明的标识符'DDTTYLogger'

即使我自己编写并具有<自安装CocoaLumberjack压缩机类以来,em>未更改。

The above happens even with classes that I wrote myself and that have not changed since installing the CocoaLumberjack compressor class.

推荐答案

在尝试使用以下命令多次尝试后,我终于解决了这一问题:

I finally solved this after MANY attempts using the following:

从我的Prefix.pch中删除最后的#import并重新构建。错误会发生(很明显)。将线放回并重新构建。没有错误会显示出来,并且大约10秒钟后,错误会再次出现。

Remove the last #import from my Prefix.pch and build again. Errors would happen (obviously). Put the line back and build again. No errors would show and after 10 seconds or so, errors would come back again.

重复上述操作,除了最后一个#import之外,删除最后两个导入,然后3、4等。直到删除5个导入,然后放回它们并等待时,Xcode才停止抱怨。

Repeat the above except instead of the last #import, remove the last TWO imports, then three, four, etc. I did this until I removed five imports and when I put them back and waited, Xcode stopped complaining.

请注意,这并没有发生完全是我我在某处的博客上阅读了此解决方案。

Note that this didn't occur to me at all. I read this solution on a blog somewhere.

奇怪的错误...

这篇关于Xcode显示许多错误,但是程序可以编译并正常运行(在模拟器和设备中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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