I’m using a scrollview, and implementing a delegate method.
-(void) scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(CGPoint *)targetContentOffset{
CGPoint p = *targetContentOffset;
int counter = [self counterForPosition:p];
*targetContentOffset=[self positionForCounter:counter];;
//load month -2;
self.month=counter-2;
}
I get a warning by Xcode.
Conflicting distributed object modifiers on parameter type in implementation of ‘scrollViewWillEndDragging:withVelocity:targetContentOffset:’
I’ve found some hints, that I do not fully understand, and does not solve my issue.
Singleton release method produces warning?
Now it’s just a warning, and nothing crashes. I think it’s my personal OCD that I want to fix this.
Tx
(CGPoint *)targetContentOffsetshould read(inout CGPoint *)targetContentOffset, to match the declaration in the protocol that you’re trying to implement. See the documentation for the protocol here: http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIScrollViewDelegate_Protocol/Reference/UIScrollViewDelegate.htmlFYI:
in,out,inout,byref,bycopy, andonewayare collectively known as the “distributed object modifiers”. They’re sort of like annotations that tell the compiler (or the reader, or the documentation system) how you’re going to be using the function parameters. In this case,targetContentOffsetpoints to a CGPoint whose value is used and then modified: it’s both aninand anoutparameter. Clang wants to be sure you know this, so if you haven’t told Clang “yes, I know it’s aninoutparameter”, Clang will show you that warning.