【发布时间】:2018-10-05 16:27:53
【问题描述】:
我正在尝试在我的应用中运行 UI 测试,但模拟器一启动我就会得到:
无法加载捆绑包“AppUITests”,因为它已损坏或缺少必要的资源。尝试重新安装捆绑包。
2018-10-05 11:04:59.772078-0500 AppUITests-Runner[53273:1645870] (dlopen_preflight(/Users/John/Library/Developer/Xcode/DerivedData/app-ios-client-ewtlrcqcxoeiaudgmthymuhcuxfz/Build/Products /Debug-iphonesimulator/AppUITests-Runner.app/PlugIns/AppUITests.xctest/AppUITests):库未加载:@rpath/libswiftSwiftOnoneSupport.dylib 引用自:/Users/John/Library/Developer/Xcode/DerivedData/app-ios-client-ewtlrcqcxoeiaudgmthymuhcuxfz/Build/Products/Debug-iphonesimulator/AppUITests-Runner.app/PlugIns/AppUITests.xctest/Frameworks/Alamofire.framework/阿拉莫菲尔 原因:图片未找到)
我的 UITest 是 Xcode 10 创建的模板,我使用的是 Cocoapods 1.5.3 和 Swift 4.2
我的项目结构:
- 工作区
- 自定义框架(Podfile 在这里)
- App A(我在这里运行 UITests)
- 应用 B
我的 podfile 如下所示:
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
target 'App Library' do
use_frameworks!
pod 'Intercom'
pod 'Spreedly'
pod 'Alamofire'
pod 'IGListKit'
pod 'CardIO'
pod 'SwiftKeychainWrapper'
pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'
pod 'SnapKit'
pod 'DateToolsSwift'
pod 'BetterSegmentedControl'
pod 'SDWebImage'
pod 'SwiftLocation'
pod 'Nuke'
pod 'Instabug'
pod 'Mixpanel-swift'
target 'App LibraryTests' do
inherit! :search_paths
# Pods for testing
end
target 'App' do
project '../App/App'
inherit! :complete
use_frameworks!
pod 'FacebookCore'
pod 'FacebookLogin'
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'App Business' do
project '../App Business/App Business'
inherit! :complete
use_frameworks!
target 'App BusinessTests' do
inherit! :search_paths
# Pods for testing
end
target 'App BusinessUITests' do
inherit! :search_paths
# Pods for testing
end
end
end
# The UI Test target I'm trying to run
target 'AppUITests' do
inherit! :search_paths
use_frameworks!
# Pods for testing
project '../App/App'
pod 'Intercom'
pod 'Spreedly'
pod 'Alamofire'
pod 'IGListKit'
pod 'CardIO'
pod 'SwiftKeychainWrapper'
pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'
pod 'SnapKit'
pod 'DateToolsSwift'
pod 'BetterSegmentedControl'
pod 'SDWebImage'
pod 'SwiftLocation'
pod 'Nuke'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'Instabug'
pod 'Mixpanel-swift'
end
workspace '../app-ios-client'
我尝试使用!inherit:complete 和!inherit:search_paths 将 UI 测试目标放在目标应用程序中,然后像上面发布的代码一样将其移到外面。我还清理了构建文件夹,删除了派生数据并重新启动了 Xcode,但我仍然遇到这个问题。我也尝试添加import UIKit 和import Alamofire,但没有任何效果。在所有这些可能的修复之间,我运行了pod deintegrate,然后是pod install。我认为这个问题可能与我的自定义框架中的 podfile 有关,但老实说我不知道。有任何想法吗?谢谢!
【问题讨论】:
-
这能回答你的问题吗? Xcode 10 - UITests - Reason: image not found
标签: ios swift xcode cocoapods xcode-ui-testing