Lal*_*alo 3 xcode ios cocoapods swift xcode-ui-testing
我正在尝试在我的应用程序中运行 UI 测试,但是一旦模拟器启动,我就会得到:
\n\n无法加载捆绑包 \xe2\x80\x9cAppUITests\xe2\x80\x9d,因为它已损坏或缺少必要的资源。尝试重新安装捆绑包。
\n\n2018-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\n 引用自:/Users/John/Library/Developer/Xcode/DerivedData/app-ios-client -ewtlrcqcxoeiaudgmthymuhcuxfz/Build/Products/Debug-iphonesimulator/AppUITests-Runner.app/PlugIns/AppUITests.xctest/Frameworks/Alamofire.framework/Alamofire\n 原因:未找到图像)
\n\n我的 UITest 是由 Xcode 10 创建的模板,我使用 Cocoapods 1.5.3 和 Swift 4.2
\n\n我的项目结构:
\n\n我的 podfile 看起来像这样:
\n\nplatform :ios, '10.0'\n\ninhibit_all_warnings!\nuse_frameworks!\n\ntarget 'App Library' do\n use_frameworks!\n\n pod 'Intercom'\n pod 'Spreedly'\n pod 'Alamofire'\n pod 'IGListKit'\n pod 'CardIO'\n pod 'SwiftKeychainWrapper'\n pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'\n pod 'SnapKit'\n pod 'DateToolsSwift'\n pod 'BetterSegmentedControl'\n pod 'SDWebImage'\n pod 'SwiftLocation'\n pod 'Nuke'\n pod 'Instabug'\n pod 'Mixpanel-swift'\n\n\n target 'App LibraryTests' do\n inherit! :search_paths\n # Pods for testing\n end\n\n target 'App' do\n project '../App/App'\n inherit! :complete\n\n use_frameworks!\n\n pod 'FacebookCore'\n pod 'FacebookLogin'\n\n target 'AppTests' do\n inherit! :search_paths\n # Pods for testing\n end\n end\n\n target 'App Business' do\n project '../App Business/App Business'\n inherit! :complete\n\n use_frameworks!\n\n target 'App BusinessTests' do\n inherit! :search_paths\n # Pods for testing\n end\n\n target 'App BusinessUITests' do\n inherit! :search_paths\n # Pods for testing\n end\n end\n\nend\n\n# The UI Test target I'm trying to run\ntarget 'AppUITests' do\n inherit! :search_paths\n use_frameworks!\n # Pods for testing\n project '../App/App'\n pod 'Intercom'\n pod 'Spreedly'\n pod 'Alamofire'\n pod 'IGListKit'\n pod 'CardIO'\n pod 'SwiftKeychainWrapper'\n pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'\n pod 'SnapKit'\n pod 'DateToolsSwift'\n pod 'BetterSegmentedControl'\n pod 'SDWebImage'\n pod 'SwiftLocation'\n pod 'Nuke'\n pod 'FacebookCore'\n pod 'FacebookLogin'\n pod 'Instabug'\n pod 'Mixpanel-swift'\nend\n\nworkspace '../app-ios-client'\nRun Code Online (Sandbox Code Playgroud)\n\n我尝试使用 和 将 UI 测试目标放入目标应用程序中,!inherit:complete然后!inherit:search_paths将其移到外部,就像上面发布的代码一样。我还清理了构建文件夹,删除了派生数据并重新启动了 Xcode,但仍然有这个问题。我也尝试过添加import UIKit,import Alamofire但没有任何效果。pod deintegrate在我运行的所有这些可能的修复之间pod install. 我认为问题可能与我的自定义框架内的 podfile 有关,但老实说我不知道。有任何想法吗?谢谢你!
我的修复类似于/sf/answers/3782438271/,只是我不关心该post_install部分。
以前我的 podfile 结构与问题中的结构类似:
platform :ios, '10.0'
target 'AppName' do
use_frameworks!
pod 'PodName'
target 'AppNameTests' do
inherit! :search_paths
end
target 'AppNameUITests' do
inherit! :search_paths
end
end
Run Code Online (Sandbox Code Playgroud)
将其更改为(较新的?)这样的结构解决了问题:
platform :ios, '10.0'
use_frameworks!
def all_pods
pod 'PodName'
end
target 'AppName' do
all_pods
end
target 'AppNameTests' do
inherit! :search_paths
all_pods
end
target 'AppNameUITests' do
inherit! :search_paths
all_pods
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2677 次 |
| 最近记录: |