Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conflicting distributed object modifiers on parameter type on Scrollview

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

like image 758
Vincent Avatar asked Oct 08 '22 04:10

Vincent


1 Answers

(CGPoint *)targetContentOffset should 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.html

FYI: in, out, inout, byref, bycopy, and oneway are 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, targetContentOffset points to a CGPoint whose value is used and then modified: it's both an in and an out parameter. Clang wants to be sure you know this, so if you haven't told Clang "yes, I know it's an inout parameter", Clang will show you that warning.

like image 137
Quuxplusone Avatar answered Oct 13 '22 11:10

Quuxplusone