How to allow detection of the No -modelLayer method for the CALayer class in iPhone unit test

I get a warning that the class method '-modelLayer' was not found for the CALayer class in the following code. According to the CALayer class reference, the modelLayer method exists. This code runs correctly, so it confirms that the implementation exists at run time. I suppose I just need to add casting to get rid of the warning, but I'm not sure what to do.

How can I resolve the warning?

I am using Xcode 4.0 Build 4A278b.

Code:

CALayer * layer = (CALayer *)(coinView.layer); CGRect newCoinFrame = [[layer modelLayer] frame]; //warning on this line 

Attention: CoinsToSlotViewControllerTest.m: 138: warning: found found method '-modelLayer

CALayer ref: http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html

+4
source share
1 answer

I think you need #import <QuartzCore/QuartzCore.h> .

+3
source

Source: https://habr.com/ru/post/1341439/


All Articles