gpt4 book ai didi

Objective-C—— undefined symbol

转载 作者:太空狗 更新时间:2023-10-30 03:22:32 28 4
gpt4 key购买 nike

我正在尝试在 cocoa touch 中使用渐变。我为此使用以下代码:

#import <QuartzCore/QuartzCore.h>

CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = mainView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor whiteColor] CGColor], nil];
[mainView.layer insertSublayer:gradient atIndex:0];

但是当我尝试编译时出现以下错误:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CAGradientLayer", referenced from: objc-class-ref in OfficeViewController.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status

我试过清理但无济于事。不确定我还能做什么?

最佳答案

确保您确实在项目中包含了 QuartzCore 框架。它应该在 Link Binary With Libraries 阶段:

enter image description here

关于Objective-C—— undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7464399/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com