【问题标题】:UITest bundle could not be loaded无法加载 UITest 包
【发布时间】:2017-07-27 05:42:31
【问题描述】:

当我在手机中运行 UITest 时,它会作为单独的应用程序安装并运行,同时会出现以下错误。

2017-07-27 10:44:33.892639+0700 XCTRunner[11886:3502890] 运行 测试... 2017-07-27 10:44:34.137927+0700 XCTRunner[11886:3502890] 捆绑“...UITests”无法加载,因为它已损坏或 缺少必要的资源。尝试重新安装捆绑包。 2017-07-27 10:44:34.137999+0700 XCTRunner[11886:3502890] (dlopen_preflight(/var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests): 库未加载: @rpath/GoogleToolboxForMac.framework/GoogleToolboxForMac 引用 从: /var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests 原因:图片未找到)

我试图为这个问题找到解决方案超过一天。

我想将 UITests 添加到我现有的应用程序中,并将 UITest 目标添加到我的应用程序中。我正在使用迦太基和可可豆荚。我更新了 pod 文件并更新了 pod,然后我将框架添加到了 carthage 安装的 UITest 目标。

这是我的 pod 文件

platform :ios, '9.0'
use_frameworks!

target 'ExampleApp' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'Google/Analytics'
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
end

target 'ExampleAppTests' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
end

target 'ExampleAppUITests' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
end

这是我的购物车文件

github "Alamofire/Alamofire" ~> 4.0
github "SwiftyJSON/SwiftyJSON" "3.0.0"
github "Friend-LGA/LGSideMenuController" ~> 1.0.0
github "TTTAttributedLabel/TTTAttributedLabel" ~> 1.13.4
github "MagicalPanda/MagicalRecord"

我可以从堆栈溢出中找到相关的question,但不幸的是它没有帮助。你能帮我将 UITest 目标添加到我的项目中吗?

【问题讨论】:

  • 遇到同样的问题。你搞清楚了吗?

标签: ios swift swift3


【解决方案1】:

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
use_frameworks!

def base_pods
    pod 'FBSDKCoreKit', '4.24.0'
    pod 'FBSDKLoginKit', '4.24.0'
    pod 'FBSDKShareKit', '4.15.0'
    pod 'FacebookCore', '0.2.0'
    pod 'FacebookLogin', '0.2.0'
    pod 'FacebookShare', '0.2.0'
end
target 'App' do
  base_pods
    target 'AppTests' do
        inherit! :search_paths
        # Pods for testing
    end

    target 'AppUITests' do
        inherit! :complete
        # Pods for UI testing
    end
end

inherit! :complete 这行是关键

UITest 目标的设置中

下一个

  • 清除派生数据
  • pod deintegrate && pod install

【讨论】:

    猜你喜欢
    • 2017-02-03
    • 1970-01-01
    • 2018-03-11
    • 2019-10-16
    • 2017-09-24
    • 2016-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多