“项目名称”是通过优化编译的 - 步进可能表现得很奇怪;变量可能无法使用 [英] 'Project Name' was compiled with optimization - stepping may behave oddly; variables may not be available

查看:1838
本文介绍了“项目名称”是通过优化编译的 - 步进可能表现得很奇怪;变量可能无法使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试进入AFNetworking代码会产生以下警告:

Trying to step into AFNetworking code generates following warning:

[Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.

当然我无法调试代码。具体来说,我正在尝试调试 UIImageView + AFNetworking 类别,这似乎是不可能的。更改代码没有任何效果(尝试 NSLog 等),当尝试进入编译器时转到汇编代码并显示 UIImageView + TVASTAFNetworking 作为类别名称,在代码库中的任何位置都不存在。

And of course I'm not able to debug the code. To be specific I'm trying to debug UIImageView+AFNetworking category which seems impossible. Changing the code has no effect (tried NSLog, etc) and when trying to step in compilers goes to assembly code and shows UIImageView+TVASTAFNetworking as category name which does not exist anywhere in the code base.

使用Xcode 7. iOS 9& 8. Cocoapods(无框架)

Using Xcode 7. iOS 9 & 8. Cocoapods (no Framework)

更新
我忘了提到Optimizer设置为 none 用于发布和调试配置,我实际上使用 Debug config。

UPDATE I forgot to mention that Optimizer is set to none for both release and debug configuration and I am in fact using Debug config.

更新2

剥离调试符号也关闭。

推荐答案

这已经很长时间但我终于解决了问题。有第三个优化标志 LTO 链接时间优化,令人惊讶的是没有人在这里提到
和由于某种原因,我也没有注意它。正好在优化级别设置之上,您可以在此处发布的许多屏幕截图中看到。

It's been a long time but I finally solved the issue. There is a third optimization flag LTO or Link Time Optimization and Surprisingly no one have mentioned it here and for some reason I didn't pay attention to it either. It's right there above the Optimization Level setting as you can see in many screen shots posted here.

总结一下它有3个不同的优化标志要关闭以进行调试:

So to summarize it there are 3 different optimization flags you want to turn off for debugging :


  • LLVM链接时间优化( -flto

  • LLVM优化级别( -O

  • Swift编译器优化级别

有关LTO的更多信息:
http://llvm.org/docs/LinkTimeOptimization .html

More information about LTO: http://llvm.org/docs/LinkTimeOptimization.html

这篇关于“项目名称”是通过优化编译的 - 步进可能表现得很奇怪;变量可能无法使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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