本文介绍了`po`给出错误:< EXPR>:1:1:error:使用未解析的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在控制台中的 po 有这个问题,试图输出一个函数本身工作,但输出一个变量或常数不。

I have this problem with po in the console where trying to output a function works in itself, but outputting a variable or constant doesn't.

正如你所看到的,虽然你认为var / let bar.boy(),Swift无法找到它...

As you can see here, although you'd think the var/let holds the content of bar.boy(), Swift somehow can't find it...

推荐答案

所以结果是,过去可能是一个错误,当你添加一个Swift文件,它会添加/问一个Bridging头,但它不会添加该行到你的项目

So it turns out there was probably a bug in the past that when you were adding a Swift file it would add/ask a Bridging header, but it wouldn't add that line to your project

SWIFT_OPTIMIZATION_LEVEL = "-Onone";

这意味着您将保持此状态

which means you'd stay in this state

导致错误:< EXPR>:1:1:错误:使用未解析的标识符

因为我在我的项目中移动文件,当我添加ObjC文件到项目,它问我一个Bridging头(虽然我有一个已经!),幸运地添加, SWIFT_OPTIMIZATION_LEVEL 。可以考虑这是一个bug,考虑默认值是最快,但是我再一次,我想这只是一个错误,过去,现在固定。

I could only find that out because I moved around files in my project and when I added ObjC files to the project, it asked me about a Bridging header (although I had one already!) and luckily added that SWIFT_OPTIMIZATION_LEVEL. One could consider this is a bug to consider the default value is fastest, but then again I guess this was only a bug in the past and got fixed now.

仍然,我现在修复它可能是一个错误,如果它在发行版中添加 none 。我现在不能测试这个,因为测试这个我只有一个 Debug 构建。我将把它作为一个练习:)给苹果工程师。

Still, I fixed now it might be a bug the other way around, if it add none in the release build. I can't test this right now because for testing this I only had a Debug build. I'll leave that as an exercise :) for Apple's Engineers.

这篇关于`po`给出错误:&lt; EXPR&gt;:1:1:error:使用未解析的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 00:34