在Xcode中抑制弃用的警告 [英] Suppressing deprecated warnings in Xcode

查看:138
本文介绍了在Xcode中抑制弃用的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着所有SDK的流动,能够为多个SDK和平台构建是很方便的。但是,从3.2跳到3.0甚至偶尔2.x,我经常得到已经改变或被取代的方法的弃用警告:

With all the SDKs floating around, it's handy to be able to build for multiple SDKs and platforms. However, bouncing from 3.2 to 3.0 and even occasionally 2.x, I frequently get deprecated warnings involving methods that have changed or been superseded:

warning: 'UIKeyboardBoundsUserInfoKey' is deprecated.

因为我仍然希望保持与旧操作系统的兼容性,而且我也在努力去除'噪音'在构建时,有没有办法关闭或禁用这些警告?

Since I still want to maintain compatibility with older OSes, and I'm also striving to remove 'noise' when building, is there a way to turn off or disable these warnings?

推荐答案

尝试 -Wno -deprecated-declarations ,或其在Xcode中的相应设置, GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS (专业提示:只需在构建设置中输入deprecated即可找到此警告的具体设置。)

Try -Wno-deprecated-declarations, or its corresponding setting in Xcode, GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS (pro tip: just type in "deprecated" in the build settings to find the specific setting for this warning).

当前版本的Xcode(例如Xcode 9.2):

Current versions of Xcode (e.g. Xcode 9.2):

Xcode的古老版本(例如Xcode 2.x,3.x) :

Ancient versions of Xcode (e.g. Xcode 2.x, 3.x):

这篇关于在Xcode中抑制弃用的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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