読者です 読者をやめる 読者になる 読者になる

CocoaPods で GHUnit と OCMock を追加してエミュレータで動かそうとしたら Linker Error が出た

iOS

CocoaPodsでGHUnit + OCMockなiOS開発環境を構築する - mtgto's diary
CocoaPodsの導入からGHUnitとOCMockのinstallとかは↑これを参考にして作業しました。

実機ビルドは普通に通るのに、エミュレータだと通らなかったので困った。

解決法は、Linked Framework and Libraries に QuartzCore.framework を追加するだけ。

一応Error全文載せた。

Ld /Users/UserName/Library/Developer/Xcode/DerivedData/CocoaPodsSample-ardhohlmedlfmghbzachrapvtkig/Build/Products/Debug-iphonesimulator/UnitTests.app/UnitTests normal i386
    cd /Users/UserName/Documents/Xcode/CocoaPodsSample
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/UserName/Library/Developer/Xcode/DerivedData/CocoaPodsSample-ardhohlmedlfmghbzachrapvtkig/Build/Products/Debug-iphonesimulator -F/Users/UserName/Library/Developer/Xcode/DerivedData/CocoaPodsSample-ardhohlmedlfmghbzachrapvtkig/Build/Products/Debug-iphonesimulator -filelist /Users/UserName/Library/Developer/Xcode/DerivedData/CocoaPodsSample-ardhohlmedlfmghbzachrapvtkig/Build/Intermediates/CocoaPodsSample.build/Debug-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -lPods-UnitTests -o /Users/UserName/Library/Developer/Xcode/DerivedData/CocoaPodsSample-ardhohlmedlfmghbzachrapvtkig/Build/Products/Debug-iphonesimulator/UnitTests.app/UnitTests

Undefined symbols for architecture i386:
  "_CACurrentMediaTime", referenced from:
      _GHRunForInterval in libPods-UnitTests.a(GHTestUtils.o)
      _GHRunUntilTimeoutWhileBlock in libPods-UnitTests.a(GHTestUtils.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)