Can't compile code when working with CALayer
15,283
Make sure you also add the QuartzCore framework to your target. Just importing the header isn't enough.
XCode Screenshot
Author by
Sheehan Alam
iOS, Android and Mac Developer. i can divide by zero.
Updated on June 13, 2022Comments
-
Sheehan Alam almost 2 years
For some reason I get linker errors when I try and use CALayer:
"_OBJC_CLASS_$_CALayer", referenced from:
I have imported the following headers:
#import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h>
Code:
arrowImage = [[CALayer alloc] init];
-
Simon Epskamp over 13 yearsIf you dont know how to do this: * right-click on you project in the Groups & Files window (on the left) * click add -> existing frameworks * select QuartzCore.framework & click Add
-
Tustin2121 about 12 yearsUpdate for XCode 4: to do this, click your project in the project navigator, in the summary tab, scroll down to Linked Frameworks, and add it there. You'll have to organize the added framework in your project navigator afterwards. :)
-
DrMickeyLauer over 8 yearsor just
@import QuartzCore;
, if you are using the new Objective-C module support.