单例释放方法会产生警告吗? [英] Singleton release method produces warning?

查看:83
本文介绍了单例释放方法会产生警告吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的单例发布方法中,我什么都不做:

In my singleton release method, I have it doing nothing:

-(void) release {
  //A whole lot of nothing.
}

但是它会产生以下警告:

But it produces this warning:

警告:在发布"的实现中,返回类型上的分布式对象修饰符冲突

我用Google搜索,发现其他人也有同样的错误,但是没有警告的解释.有人知道警告是关于什么的吗?

I googled and saw others have the same error, but no explanation of the warning. Anyone know what the warning is about?

推荐答案

您需要将其声明为oneway.

- (oneway void) release {}

oneway是与分布式对象一起使用的关键字,指示可以异步进行调用.由于NSObject标头在声明release方法时会使用它,因此您也必须使用它.除非您使用分布式对象,否则它不会影响您的程序,但它将满足编译器的要求.

oneway is a keyword used with distributed objects to indicate that the call can be made asynchronously. Since the NSObject header uses it when it declares the release method, you must also use it. It won't affect your program unless you use distributed objects, but it will satisfy the compiler.

这篇关于单例释放方法会产生警告吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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