Objective-C - 未定义的符号 [英] Objective-C – Undefined symbols

查看:130
本文介绍了Objective-C - 未定义的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在可可触摸中使用渐变。我使用以下代码:

I'm trying to use a gradient in cocoa touch. I'm using the following code for this:

#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];

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

But I get the following error when I try to compile:


架构i386的未定义符号:

_OBJC_CLASS _ $ _ CAGradientLayer,引用自:
OfficeViewController.o中的objc-class-ref ld:找不到符号
for architecture i386 collect2:ld returned 1 exit status

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

干净无济于事。不确定我还能做什么?

I've tried to do a clean to no avail. Not really sure what else I can do?

推荐答案

确保你实际上在项目中包含QuartzCore框架。它应该在链接二进制与库的阶段:

Make sure you actually included the QuartzCore framework in your project. It should be in the Link Binary With Libraries phases:

这篇关于Objective-C - 未定义的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆