`po` 给出 `error: <EXPR>:1:1: error: use of unresolved identifier` [英] `po` gives `error: <EXPR>:1:1: error: use of unresolved identifier`

查看:17
本文介绍了`po` 给出 `error: <EXPR>:1:1: error: use of unresolved identifier`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在控制台中的 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 文件时,它会添加/询问桥接头,但它不会t 将该行添加到您的项目中

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: error: use of unresolved identifier

我只能找到它,因为我在项目中移动了文件,当我将 ObjC 文件添加到项目中时,它询问了我关于桥接头的问题(虽然我已经有了一个!)并且幸运地添加了 SWIFT_OPTIMIZATION_LEVEL.人们可以认为这是一个错误,因为默认值是 fastest,但我想这只是过去的一个错误,现在已经修复.

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 构建.我将把它作为练习 :) 留给 Apple 的工程师.

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` 给出 `error: &lt;EXPR&gt;:1:1: error: use of unresolved identifier`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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