Empty release: method causing warnings


Starting in Chapter 10 in PossessionStore we override the release: method, adding no statements, and the same is done later in ImageStore.

When building the project, a warning message is thrown up for each of these saying "Conflicting distributed object modifiers on return type in implementation of ‘release’ ".

If this were an application I tried to submit to the app store, is it likely to be rejected because of these warning messages?

Is there anything one can do to remove these messages whilst keeping the integrity of these classes?




An app wouldn’t be rejected for containing warning messages but they are worth investigating to make sure that the app doesn’t have any unexpected behaviour - which may lead to a rejection.

You can get rid of the warning using

-(oneway void) release { }

to match the signature in NSObject.h



Many thanks for that Gareth.

I will use your suggested method change and look into what this means to get an understanding of what I am doing (unless you wish to elaborate what this does differently :wink: )



According to a thread over in the Apple Developer Forum, which was replied to by someone at Apple -

[color=#008000]"This generally means you are missing the “oneway” keyword from your implementation of -release. “oneway”, in the context of distributed objects (only available to Mac OS X), means that DO does not have to wait for the method call to traverse to the other side of the connection and back before it returns. It means it should return instantly and assume all went well.

-release is declared in the NSObject class as - (oneway void)release, and because of this, subclasses that do not declare it the same way can get a warning if the proper compiler flags are set. The easiest solution is to declare -release the same way as NSObject (see NSObject.h). It should have no side effects on operation."[/color]

He mentions that is only for Mac OS X, however people are using it for iOS - hmmmmm.




I guess it’s just a side effect of NSObject being common to both Mac and iOS.

It don’t believe it makes any difference to the functionality on iOS.