我对API进行了更改,并且我希望将一个方法标记为已弃用。 我在它的签名上写了以下内容: 属性((不建议使用(“不要使用此方法”))); 但是,我不知道如何在方法体本身中表现。
无法找到任何关于Apple编码的信息开始引领我。 该方法返回BOOL。 我应该回假吗?
答案 0 :(得分:3)
不推荐使用意味着该方法仍然有效,但可以在将来的版本中删除,并且最好使用新方法。
您可以向使用弃用方法的用户提供一些其他信息:
/**
* @deprecated This method is deprecated starting in version x.x
* @note Please use @code newMethod:withNewParameter: @endcode instead.
*/
-(void)depFunction:(id)x __attribute__((deprecated));
当他使用时:
[yourClassObj depFunction:@"argument"];
快速帮助面板将显示如下信息:
您可能还想将attribute((deprecated("Don't use this method")));
更改为DEPRECATED_MSG_ATTRIBUTE("Don't use this method, use the other one instead.");