在过去的几天里,我一直用头撞墙,但尽管有多次Google/SO/Github搜索,我找不到解决我遇到的问题的方法!
我要做的就是为我的应用程序创建一些使用Firebase pod的单元测试.
我正在使用Xcode 7.3.1和Cocoapods 1.0.1.更新:问题仍然存在于Xcode 8.0中
使用此podfile:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
target 'MyApp' do
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
target 'MyAppTests' do
inherit! :search_paths
end
end
Run Code Online (Sandbox Code Playgroud)
在我的XCTest课程中,我得到了
缺少必需的模块'Firebase'
错误 @testable import MyApp
或者使用此podfile:
platform :ios, '9.0'
use_frameworks!
inhibit_all_warnings!
def common_pods
pod 'SwiftyTimer'
pod 'Firebase'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
end
target 'MyApp' do
common_pods
end
target 'MyAppTests' do
common_pods
end
Run Code Online (Sandbox Code Playgroud)
测试构建但我的控制台上到处都是警告,例如:
类<-FirebaseClassName->在...中实现... MyApp ...和... MyAppTests ...将使用其中一个.哪一个未定义
我正在尝试在我的应用程序中运行 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 …Run Code Online (Sandbox Code Playgroud)