链接器命令失败,架构i386的未定义符号

Xav*_*ero 10 iphone page-curl catransition ios4

我正在尝试做半页卷曲功能.这是我正在使用的代码:

#import <QuartzCore/QuartzCore.h>


CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:(notCurled ? @"mapCurl" : @"mapUnCurl")];
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
notCurled = !notCurled;
Run Code Online (Sandbox Code Playgroud)

但是我遇到了以下错误

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CATransition", referenced from:
      objc-class-ref in MyMapViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


  "_OBJC_CLASS_$_CATransition", referenced from:


      objc-class-ref in SJMapViewController.o


ld: symbol(s) not found for architecture i386


clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

sha*_*oga 23

你的应用程序抱怨它无法找到CATransition Symbol.

你有没有将QuartzCore框架添加到你的应用程序中?

如果不添加它:转到目标设置 - >构建阶段 - >链接二进制 - >选择+按钮并选择QuartzCore.

然后在需要使用它的地方导入它:

      #import <QuartzCore/QuartzCore.h>
Run Code Online (Sandbox Code Playgroud)

  • 有这个相同的问题,但它与我从另一个库导入我的项目的代码有关.如果有人遇到这个问题,请进入Build Phases并将导入的文件添加到Compile Sources. (3认同)