Singleton release method produces warning?

后端 未结 2 1257
不思量自难忘°
不思量自难忘° 2020-12-24 01:57

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

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

But it produces this warning:

2条回答
  •  死守一世寂寞
    2020-12-24 02:35

    You need to declare it oneway.

    - (oneway void) 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.

提交回复
热议问题