我正在尝试测试一个寄存器viewController在成功注册后继续到另一个viewController。一旦这个测试运行,我试图删除在firebase上创建的用户:
func removeUser() {
if let user = Auth.auth().currentUser {
user.delete(completion: { error in
if let error = error {
print(error)
}
})
}
}
在我将此函数添加到文件之前测试运行正常,但在我将其添加到测试文件并尝试运行测试之后我得到:
"_OBJC_CLASS_$_FIRAuth", referenced from:
linker command failed with exit code 1 (use -v to see invocation)
我在单元测试中成功使用了相同的功能,但由于一些奇怪的原因,这在ui测试中不起作用。
以下是完整的错误日志:
Ld /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator/WelcomeScreenTests-Runner.app/PlugIns/WelcomeScreenTests.xctest/WelcomeScreenTests normal x86_64
cd /Users/waynerumble/Desktop/tddsplitter/Splitter
export IPHONEOS_DEPLOYMENT_TARGET=11.0
export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk -L/Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator -L/Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator/GTMSessionFetcher -L/Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac -L/Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator/nanopb -F/Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseAnalytics/Frameworks -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseAuth/Frameworks -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseCore/Frameworks -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseDatabase/Frameworks -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseInstanceID/Frameworks -F/Users/waynerumble/Desktop/tddsplitter/Splitter/Pods/FirebaseStorage/Frameworks -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -filelist /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Intermediates.noindex/Splitter.build/Debug-iphonesimulator/WelcomeScreenTests.build/Objects-normal/x86_64/WelcomeScreenTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -mios-simulator-version-min=11.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Intermediates.noindex/Splitter.build/Debug-iphonesimulator/WelcomeScreenTests.build/Objects-normal/x86_64/WelcomeScreenTests_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Intermediates.noindex/Splitter.build/Debug-iphonesimulator/WelcomeScreenTests.build/Objects-normal/x86_64/WelcomeScreenTests.swiftmodule -ObjC -lc++ -licucore -lsqlite3 -lz -framework CFNetwork -framework MobileCoreServices -framework Security -framework StoreKit -framework SystemConfiguration -framework XCTest -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Intermediates.noindex/Splitter.build/Debug-iphonesimulator/WelcomeScreenTests.build/WelcomeScreenTests.xctest.xcent -lPods-WelcomeScreenTests -Xlinker -dependency_info -Xlinker /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Intermediates.noindex/Splitter.build/Debug-iphonesimulator/WelcomeScreenTests.build/Objects-normal/x86_64/WelcomeScreenTests_dependency_info.dat -o /Users/waynerumble/Library/Developer/Xcode/DerivedData/Splitter-fgegrycgijcewrgdrhbzitkzbsmm/Build/Products/Debug-iphonesimulator/WelcomeScreenTests-Runner.app/PlugIns/WelcomeScreenTests.xctest/WelcomeScreenTests
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIRAuth", referenced from:
objc-class-ref in WelcomeScreenTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
任何帮助都会非常感谢。
更新:
podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Splitter' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
#use_frameworks!
def allPods
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
end
# Pods for Splitter
allPods
target ‘BillTests’ do
inherit! :search_paths
allPods
end
target ‘ItemTests’ do
inherit! :search_paths
allPods
end
target ‘UserTests’ do
inherit! :search_paths
allPods
end
target ‘WelcomeScreenTests’ do
inherit! :search_paths
allPods
end
end