iPhone-使用CALay时无法编译代码

由于某些原因,当我尝试使用CALayer时出现链接器错误:

  "_OBJC_CLASS_$_CALayer", referenced from:

我已导入以下标头:

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

码:

arrowImage = [[CALayer alloc] init];
1个解决方案
80 votes

确保您还将QuartzCore框架添加到目标中。 仅导入标题是不够的。

XCode屏幕截图enter image description here

Cory Kilger answered 2020-08-10T20:43:41Z
translate from https://stackoverflow.com:/questions/2968071/cant-compile-code-when-working-with-calayer