我試圖嘗試在Xcode 4.4新的單元測試(對我來說是新的,因爲我以前使用OHUnit)。石英核心干擾運行單元測試
我有幾個類我添加到目標,但其中一個參考QuartzCore。
顯然我聯繫我的單元測試目標到QuartzCore框架,但它無法運行:
Undefined symbols for architecture armv7s:
"_CGBitmapContextCreateImage", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGContextDrawImage", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGBitmapContextCreate", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGImageGetBitsPerComponent", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGImageRelease", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGContextSetShadowWithColor", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGContextRelease", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGRectZero", referenced from:
-[UIImage(Additions) imageByScalingProportionallyToSize:] in UIImage+Additions.o
"_CGColorSpaceRelease", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
"_CGColorSpaceCreateDeviceRGB", referenced from:
-[UIImage(Additions) imageWithShadow] in UIImage+Additions.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我的構建目標成功建立,而不是單元測試目標。
我已經嘗試創建一個空白的新項目,並添加一個文件,使用QuartzCore和我有同樣的問題。
任何人都會遇到這個問題或者有什麼有用的建議嗎?
感謝
您的單元測試目標是否與您的應用程序鏈接並注入到它中? –
是的。爲了弄清楚出了什麼問題,我創建了一個新項目 - 包括單元測試。運行它,它的工作原理。然後我鏈接到QuartzCore,並添加了其他項目中的一個源文件。該項目編譯,但如果我去產品>測試 - 然後失敗,找不到上述符號。 – bandejapaisa
奇怪的是,我從來沒有遇到QuartzCore干擾測試的問題。你能把你的示例項目放在什麼地方嗎? –