我如何将一个函数标记为在iPhone Objective C头文件中被弃用? [英] How do I flag a function as being deprecated in an iPhone Objective C header file?

查看:142
本文介绍了我如何将一个函数标记为在iPhone Objective C头文件中被弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道如何做到这一点?



我猜这只是一些关键字,我可以在某个地方继续使用该功能。



编辑:如果有人尝试使用不推荐使用的函数,我想要生成一个编译器警告,类似于Apple API中的行为。 b
$ b

干杯!
Nick。

解决方案

尝试在您的方法声明中附加属性:

   - (void)fooBar __attribute__((deprecated));  

取自此处


Does any one know how to do this?

I'm guessing there's just some keyword I can stick after the function somewhere?

EDIT: I would like for a compiler warning to be generated should anyone try and use the deprecated function, similar to the behavior seen in Apple's APIs.

Cheers! Nick.

解决方案

Try appending an attribute to your method declaration:

- (void)fooBar __attribute__ ((deprecated));

Taken from here.

这篇关于我如何将一个函数标记为在iPhone Objective C头文件中被弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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