【发布时间】:2023-04-03 01:25:02
【问题描述】:
我正在尝试在我正在开发的应用程序中实现 UITest。
当我在我的 UITests.swift 文件中并尝试从测试中运行应用程序时,Xcode 为我正在使用的一些 pod 提供以下错误:
Command CompileSwift failed with a nonzero exit code
它会在运行常规项目时为一堆正在编译的 pod 提供此错误:
我的 PodFile 如下所示:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
source 'https://github.com/cocoapods/specs.git'
project 'Project.xcodeproj'
use_frameworks!
# Define all thirdparty pods we need
def thirdparty
pod 'Moya', '~> 11.0'
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'Differ'
.. a bunch of other pods
end
# Pods for Project project
target 'Project' do
thirdparty
end
# Pods for ProjectTests
target 'ProjectUITests' do
thirdparty
pod 'Nimble'
end
我很难解释为什么会发生这种情况,因为我的项目通常编译得很好。 S.O. 上的其他帖子关于这个问题报告,在构建项目时也会出现问题,而不仅仅是运行测试
问题如何确保我在项目中使用的所有 pod 在从 UITest 构建时也能正确编译?
【问题讨论】:
标签: ios swift cocoapods xcode-ui-testing uitest