ld:找不到架构 i386 Xcode 单元测试的符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18776985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ld: symbol(s) not found for architecture i386 Xcode unit tests
提问by Sarp Kaya
I am getting this error when I try to run my unit tests. The entire error is:
当我尝试运行单元测试时出现此错误。整个错误是:
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)
I did all the instructions here: http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
我在这里做了所有的说明:http: //twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
Also added the library to "Compile Sources" in Build Phrases of the test target. Still no luck.
还将库添加到测试目标的构建短语中的“编译源”。仍然没有运气。
回答by Michael Dautermann
Looks like you need to add "CoreGraphics.framework" and "ApplicationServices.framework
" to your unit test target membership.
看起来您需要将“CoreGraphics.framework”和“ ApplicationServices.framework
”添加到您的单元测试目标成员资格中。
Here's how it's done for a file:
以下是对文件的处理方式:
Just go to "CoreGraphics.framework" in the list of files and folders on the left side and make certain the checkmark is "ON" for the unit tests target.
只需转到左侧文件和文件夹列表中的“CoreGraphics.framework”,并确保单元测试目标的复选标记为“ON”。
回答by Mosib Asad
Go to build phases of target, Add ImageIO.framework
转到目标的构建阶段,添加ImageIO.framework