【发布时间】:2016-04-07 06:12:30
【问题描述】:
我有一个 Xcode 工作区,其中包含 2 个 Swift 项目、OAuth 和 Commons。
每个项目都有一个 iOS 框架目标和一个测试目标。它们不相互依赖。
Commons 项目无依赖关系,而 OAuth 框架目标导入 WebKit (import WebKit)。
现在,如果我在 Xcode 中运行测试,OAuth 测试工作正常,但 Commons 测试失败并显示以下 Xcode 错误日志:
Test target CommonsTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
如果我使用以下命令从命令行运行测试
xcodebuild -workspace Workspace.xcworkspace -configuration Debug -destination "platform=iOS Simulator,name=iPhone 6" -scheme OAuth test
xcodebuild -workspace Workspace.xcworkspace -configuration Debug -destination "platform=iOS Simulator,name=iPhone 6" -scheme Commons test
第二个命令后出现以下错误:
The bundle “CommonsTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
(dlopen_preflight(~/Library/Developer/Xcode/DerivedData/Workspace-aslcnsaomwggxqcxoozzfuztgszf/Build/Products/Debug-iphonesimulator/CommonsTests.xctest/CommonsTests): Library not loaded: @rpath/libswiftWebKit.dylib
Referenced from: ~/Library/Developer/Xcode/DerivedData/Workspace-aslcnsaomwggxqcxoozzfuztgszf/Build/Products/Debug-iphonesimulator/OAuth.framework/OAuth Reason: image not found)
我的设置可能有什么问题? 其他人也会出现这个问题吗?
解决方法:
1) 如果我还在 CommonsTests 捆绑包中包含 WebKit,一切正常。 但由于 OAuth 和 Commons 框架之间没有依赖关系,我看不出有任何必要这样做的理由。
2) 如果我将 OAuth 项目(和目标)重命名为 OAuth2 之类的,一切正常。 这真的很奇怪。可能是名称冲突或缓存问题。
重命名解决方法是否可以解决其他人的问题?
示例项目:https://www.dropbox.com/s/dn3ywhxlc9kb6y4/SampleProject.zip?dl=0
设置:
Xcode 7.3(Xcode 7.2 也出现错误)
OS X 10.11.4(OS X 10.11.3 也出现错误)
【问题讨论】: