Singleton release method produces warning?

后端 未结 2 1246
不思量自难忘°
不思量自难忘° 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条回答
  •  梦毁少年i
    2020-12-24 02:16

    In NSObject.h, the definition of the release method returns a oneway void.

    The oneway keyword is used for distributed objects.

    Since Xcode4.2 and LLVM, checkings are more strong and if it was accepted by previous versions of Xcode or by gcc, you now need to add this oneway keyword so that the LLVM compiler stops warning about this.

    -(oneway void) release { /* do nothing */ }
    

    This won't have any incident on your code.

提交回复
热议问题