【问题标题】:ld: symbol(s) not found for architecture i386 Xcode unit testsld:未找到架构 i386 Xcode 单元测试的符号
【发布时间】:2013-09-13 01:48:10
【问题描述】:

我在尝试运行单元测试时收到此错误。整个错误是:

    Undefined symbols for architecture i386:
  "_CGImageRelease", referenced from:
      _releaseImages in UIImage+animatedGIF.o
  "_CGImageSourceCopyPropertiesAtIndex", referenced from:
      _delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
  "_CGImageSourceCreateImageAtIndex", referenced from:
      _createImagesAndDelays in UIImage+animatedGIF.o
  "_CGImageSourceCreateWithData", referenced from:
      +[UIImage(animatedGIF) animatedImageWithAnimatedGIFData:] in UIImage+animatedGIF.o
  "_CGImageSourceCreateWithURL", referenced from:
      +[UIImage(animatedGIF) animatedImageWithAnimatedGIFURL:] in UIImage+animatedGIF.o
  "_CGImageSourceGetCount", referenced from:
      _animatedImageWithAnimatedGIFImageSource in UIImage+animatedGIF.o
  "_kCGImagePropertyGIFDelayTime", referenced from:
      _delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
  "_kCGImagePropertyGIFDictionary", referenced from:
      _delayCentisecondsForImageAtIndex in UIImage+animatedGIF.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在这里做了所有的说明: http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/

还将库添加到测试目标的构建短语中的“编译源”中。还是没有运气。

【问题讨论】:

    标签: xcode unit-testing testing target


    【解决方案1】:

    您似乎需要将“CoreGraphics.framework”和“ApplicationServices.framework”添加到您的单元测试目标成员资格中。

    这是对文件的处理方式:

    只需转到左侧文件和文件夹列表中的“CoreGraphics.framework”,并确保单元测试目标的复选标记为“ON”。

    【讨论】:

    • 谢谢你,这只是通过摆脱第一个“_CGImageRelease”将错误数量从 9 个更改为 8 个。但是,我添加了我所有的框架,它确实有效。
    • 啊,是的...您还需要打开“UIImage+animatedGIF.m”的目标成员资格。
    • 确保它也设置为“ApplicationServices.framework”。
    • 是的!有时我在其他库上使用了一些文件,但我没有添加它!
    【解决方案2】:

    进入目标的构建阶段,添加ImageIO.framework

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      相关资源
      最近更新 更多