Rom*_*mov 26
我能够使用Xcode 10.1生成的项目重现此问题.我使用Swift 4.2和CocoaPods作为依赖管理器.我有以下Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
然后我删除了use_frameworks!,看到这个链接了解更多细节:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'MyApp' do
# Pods for MyApp
pod 'Alamofire', '4.8.1'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
我也收到了一些这样的警告:
[!] The `MyAppUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyApp-MyAppUITests/Pods-MyApp-MyAppUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)
这就是我从MyAppUITests构建设置中删除此行的原因:
在那次运行pod deintegrate && pod install之后,问题就消失了.可能对于具有更多依赖项的项目(如此处),您需要使用其他解决方案.
小智 13
这是因为您的广告连播仅适用于框架目标,而没有适用于测试目标。将测试目标添加到您的Podfile。
范例:
target 'MyFramework' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
target 'MyFrameworkTests' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
end
Run Code Online (Sandbox Code Playgroud)
Sam*_*uël 12
检查UITest目标“构建设置”中的部署目标是否设置为与您要测试的主机应用程序相同。就我而言,我稍后添加了UITesting目标,并使用默认的部署目标iOS 12创建了该目标。如果您随后尝试在低于12的iOS上运行UITest,则会出现问题中提到的错误。
就我而言,我需要用分隔UI测试目标use_frameworks!。
如果您use_frameworks!在Podfile顶部的全局某处全局指定,则将UI测试目标从嵌套结构移动到其自身将无济于事。
出现错误的Podfile(原始):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
target 'MyProject' do
pod 'R.swift', '~> 5.0'
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
target 'MyProjectUITests' do
inherit! :search_paths
end
end
Run Code Online (Sandbox Code Playgroud)
出现错误的Podfile(首先尝试修复):
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
Run Code Online (Sandbox Code Playgroud)
最后的工作Podfile:
platform :ios, '10.0'
inhibit_all_warnings!
def shared_pods
pod 'R.swift', '~> 5.0'
end
target 'MyProject' do
use_frameworks!
shared_pods
pod 'Moya/RxSwift', '~> 12.0'
# and other pods
target 'MyProjectTests' do
inherit! :search_paths
pod 'iOSSnapshotTestCase', '~> 6.0'
end
end
target 'MyProjectUITests' do
shared_pods
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17211 次 |
| 最近记录: |