0

After adding in the AVFoundation framework to my class this code breaks. Both lines where I get the position of the presentation layer of two views that are being animated with CAKeyFrameAnimation function fine and give no errors. As soon as I import the AVFoundation header into the source file they break and complain saying multiple methods named position found with mismatched result, parameter type, or attribute.

I have no idea what it is about adding in this framework that breaks this code.

-(void)orbDistance {

CGPoint one = [[[self.orbOrange layer] presentationLayer] position];
    CGPoint two = [self.orbGreen.layer.presentationLayer position];

CGFloat xDist = (two.x - one.x);
CGFloat yDist = (two.y - one.y);
CGFloat distance = sqrt((xDist * xDist) + (yDist * yDist));

NSLog(@"orange: %.0f", distance);
}
  • In general if you are getting this error this means there is a casting problem in your code. I'm sure we may need to explicitly say the casting to the xCode. Can you please let me know where exactly you are getting this error? IN which line of code? – Bluewings Aug 18 '15 at 05:11
  • the errors occur on lines 2 and 3. Or the two lines that get the position of the presentation layer. – Alexander Bollbach Aug 18 '15 at 12:05
  • Try explicitly casting the Class name of PresentationLayer. It should resolve your issues. Something like this `(<>)[[self.orbOrange layer] presentationLayer]`. Complier gets confused so we have to say presentation layer is belongs to particular class. Im not sure what class is your presentationLayer. – Bluewings Aug 20 '15 at 02:43

0 Answers0