弃用意味着该方法仍然有效,但可以在未来版本中删除,新方法是最受青睐的。
您可以向使用已弃用方法的用户提供一些附加信息:
/**
* @deprecated This method is deprecated starting in version x.x
* @note Please use @code newMethod:withNewParameter: @endcode instead.
*/
-(void)depFunction:(id)x __attribute__((deprecated));
Run Code Online (Sandbox Code Playgroud)
当他使用类似:
[yourClassObj depFunction:@"argument"];
Run Code Online (Sandbox Code Playgroud)
快速帮助面板将显示如下信息:

您可能还想更改attribute((deprecated("Don't use this method")));为DEPRECATED_MSG_ATTRIBUTE("Don't use this method, use the other one instead.");
| 归档时间: |
|
| 查看次数: |
2711 次 |
| 最近记录: |