单元目标测试构建失败xcode目标c

时间:2016-02-25 12:52:49

标签: ios objective-c xcode unit-testing testing

好吧,当我运行应用程序时,应用程序在没有任何警告或错误的情况下工作,但是当我尝试测试它时,我遇到了一堆错误,如下所示:

Undefined symbols for architecture x86_64:
"_CGRectGetMidX", referenced from:
  -[GameOver initWithSize:playerLose:] in GameOver.o
  -[GameOver overBackground] in GameOver.o
  -[TitleScene initWithSize:] in TitleScene.o
"_CGRectGetMidY", referenced from:
  -[GameOver overBackground] in GameOver.o
  -[TitleScene initWithSize:] in TitleScene.o
"_OBJC_CLASS_$_SKAction", referenced from:
  objc-class-ref in GameOver.o
  objc-class-ref in TitleScene.o
"_OBJC_CLASS_$_SKLabelNode", referenced from:
  objc-class-ref in GameOver.o
"_OBJC_CLASS_$_SKScene", referenced from:
  _OBJC_CLASS_$_GameOver in GameOver.o
  _OBJC_CLASS_$_TitleScene in TitleScene.o
"_OBJC_CLASS_$_SKSpriteNode", referenced from:
  objc-class-ref in GameOver.o
  objc-class-ref in TitleScene.o
"_OBJC_CLASS_$_SKTransition", referenced from:
  objc-class-ref in GameOver.o
  objc-class-ref in TitleScene.o
"_OBJC_CLASS_$_UIDevice", referenced from:
  objc-class-ref in GameOver.o
  objc-class-ref in TitleScene.o
"_OBJC_METACLASS_$_SKScene", referenced from:
  _OBJC_METACLASS_$_GameOver in GameOver.o
  _OBJC_METACLASS_$_TitleScene in TitleScene.o
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

转到

  

TargetSettings - >构建阶段 - >编译源 - >添加.m文件(您收到错误消息)    - >构建并运行

还有一种可能性是检查您是否正确添加了所有框架?