如何弃用整个协议?

发布于 2024-12-04 05:13:20 字数 271 浏览 3 评论 0原文

是否可以弃用整个协议?我使用的是 iOS SDK 5.0 Beta 7 附带的 GCC 编译器。

DEPRECATED_ATTRIBUTE 似乎不起作用。

例如,以下两条语句无法编译。

  • @protocol DEPRECATED_ATTRIBUTE MyProtocol
  • @protocol MyProtocol DEPRECATED_ATTRIBUTE

Is it possible to deprecate an entire protocol? I'm using the GCC compiler that is shipped with iOS SDK 5.0 Beta 7.

DEPRECATED_ATTRIBUTE doesn't seem to work.

For example, the following two statements do not compile.

  • @protocol DEPRECATED_ATTRIBUTE MyProtocol
  • @protocol MyProtocol DEPRECATED_ATTRIBUTE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最笨的告白 2024-12-11 05:13:21

我自己没有尝试过,但我认为以下语法应该有效。

__attribute__ ((deprecated))
@protocol MyProtocol
@end

这与弃用整个接口和单个方法的语法类似。

__attribute__ ((deprecated))
@interface MyClass
@end

@interface MyClass2
- (void) method __attribute__((deprecated));
@end

I haven't tried this myself, but I think that the following syntax should work.

__attribute__ ((deprecated))
@protocol MyProtocol
@end

This parallels the syntax for deprecating an entire interface as well as a single method.

__attribute__ ((deprecated))
@interface MyClass
@end

@interface MyClass2
- (void) method __attribute__((deprecated));
@end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文