键入时关闭Xcode的未使用变量警告 [英] Turn off Xcode's unused variable warnings while typing

查看:141
本文介绍了键入时关闭Xcode的未使用变量警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在打字时对Xcode大量使用实时未使用的变量警告感到厌烦。我一直以为自己的语法有错误,停止我正在做的事情,检查警告,只是看到它是未使用的变量警告。





当然它是未使用的,我只是输入了它!



我不介意编译时未使用的变量警告,它们非常有用,但是我讨厌在输入代码时使用实时警告。



有什么办法可以在整个应用程序范围内或整个项目中完全关闭此警告?

解决方案

截至目前,我们无法通过将 #pragma clang诊断... 用于obj-C的方式来抑制特定警告。参见例如以下线程





  • I'm sick to death of Xcode's prolific use of live "unused variable" warnings while I am typing. I keep thinking I have an error in my syntax, stop what I'm doing, check the warning, only to see it's an unused variable warning.

    Of course it's unused, I just typed it!

    I don't mind the compile-time unused variable warnings, those are very useful, but I hate the live warnings as I'm typing code.

    Is there any way I can turn off this warning completely everywhere, either app-wide or for an entire project?

    解决方案

    It seems as of currently, we cannot suppress specific warnings in the way #pragma clang diagnostic ... could be used for obj-C. See e.g. the following thread


    There is possible to disable all interactive warnings globally, by disabling Show live issues, from Xcode -> Preferences: Tab General. This, however, in excess of disabling all live warnings, also disable live errors, so something I presume you wouldn't want to resort to.


    [Build warnings] You can turn off custom build warnings project-wide as follows:

    • Select your project in the navigator, and choose tab Build Settings. Find Apple LLVM 7.0 - Warnings - All Languages, and disable the warnings for Unused Values and Unused Variables.

    这篇关于键入时关闭Xcode的未使用变量警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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