Frameworkのテストコードで”Library not loaded: @rpath/libswiftCoreAudio.dylib”

Written by じび on 8月 27th, 2015

iOSでFrameworkのテストコードを書いたのですが、テストを実行しようとすると、ビルドは成功するのですが、テスト実行時に以下のエラーが出てテストが行われませんでした。

2015-08-27 08:35:04.489 xctest[1176:62057] The test bundle at /Users/who/Library/Developer/Xcode/DerivedData/XxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxxTests.xctest could not be loaded because an unanticipated error occurred.
2015-08-27 08:35:04.490 xctest[1176:62057] Detailed error information: Error Domain=NSCocoaErrorDomain Code=3587 “The bundle “xxxTests” couldn’t be loaded because it is damaged or missing necessary resources.” (dlopen_preflight(/Users/who/Library/Developer/Xcode/DerivedData/XxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxxTests.xctest/xxxTests): Library not loaded: @rpath/libswiftCoreAudio.dylib
Referenced from: /Users/who/Library/Developer/Xcode/DerivedData/XxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxx.framework/xxx
Reason: image not found) UserInfo=0x7f9a39422c50 {NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/who/Library/Developer/Xcode/DerivedData/XxxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxxTests.xctest/xxxTests, NSDebugDescription=dlopen_preflight(/Users/who/Library/Developer/Xcode/DerivedData/XxxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxxTests.xctest/xxxTests): Library not loaded: @rpath/libswiftCoreAudio.dylib
Referenced from: /Users/who/Library/Developer/Xcode/DerivedData/XxxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxx.framework/xxx
Reason: image not found, NSBundlePath=/Users/who/Library/Developer/Xcode/DerivedData/XxxxFramework-gpqmrnxhtltpenbdidiiwacuonzd/Build/Products/Debug-iphonesimulator/xxxTests.xctest, NSLocalizedDescription=The bundle “xxxTests” couldn’t be loaded because it is damaged or missing necessary resources.}

*** Test session exited(1) without checking in. If you believe this error represents a bug, please attach the log file at /var/folders/nt/x60j01ps3r3dds9ldvppd5xm0000gn/T/com.apple.dt.XCTest-status/Session-2015-08-27_08:35:01-Z4Gt8p.log

  • framework内でAVFoundationにリンクしています。
  • CoreLocationを使用しています。
  • サンプルアプリに組み込んだframeworkは正常に動作していました。

cleanしたり、再起動したりしたのですが、改善しませんでした。色々試した結果、以下のBuild Settingsを変更したところ、正常に動くようになりました。

Embedded Content Contains Swift Code = NO -> YES

ですが、これで動くようになった理由がわかりません。
新しくframeworkを作るとデフォルトでNOになっているのは確認しました。

 

Leave a Comment