如果在Objective-C中废弃一个方法
栏目: Objective-C · 发布时间: 7年前
内容简介:如果在Objective-C中废弃一个方法
最新在从事SDK方向的开发 有的时候 不能轻易的把某个API去掉 因为有些人还在使用 于是为了保留 相关方法 并标识为弃用 的方式 我采用如下代码
__attribute__((deprecated("此方法已弃用,请使用xxxxx:方法")));
场景1
我想标识一个方法使用其它方式传入某个参数
例如:控制器中我想标识设置URL的方法直接使用setter方法就可以了
@interface VideoEditorViewController : UIViewController @property(nonatomic, strong)NSURL *videoPath; -(instancetype)initWithUrl:(NSURL *)path __attribute__((deprecated("使用setVideoPath:方法传入"))); @end
这样调用的时候就直接显示警告了 告诉当前方法传入URL被弃用
相关 __attribute__
更多用法 请参考苹果官方文档和其它博客
后续会持续更新更多用法
全文完
打赏二维码

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Node 最古老的 npm 包 request 将被废弃
- Debian/Ubuntu清理无效包、废弃包、冗余包、rc包
- Android Studio 3.5 稳定版发布,废弃 Instant Run
- [译] CMS GC:CMS 废弃了,该怎么办呢?
- XXL-CONF v1.6.0 发布,废弃 ZK 轻量级架构升级
- XXL-CONF v1.6.0 发布,废弃 ZK 轻量级架构升级
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
RESTful Web Services Cookbook
Subbu Allamaraju / Yahoo Press / 2010-3-11 / USD 39.99
While the REST design philosophy has captured the imagination of web and enterprise developers alike, using this approach to develop real web services is no picnic. This cookbook includes more than 10......一起来看看 《RESTful Web Services Cookbook》 这本书的介绍吧!