首页 > 解决方案 > ld:由于残留的 Firebase 组件,未找到框架 FirebaseAuth 错误

问题描述

我在我的 nativescript javascript 应用程序中使用 firebase 身份验证、消息传递和实时数据库。我可以在 iOS 模拟器和具有调试和发布版本的设备上很好地构建和运行,但我注意到一些 crashlytics 日志消息。我已准备好上传到 App Store,但是当我使用 Xcode 构建时,我收到以下错误:

ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseAuth'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseCoreDiagnostics'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseDatabase'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseInAppMessaging'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseInAppMessagingDisplay'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseInstanceID'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/FirebaseMessaging'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/GoogleDataTransport'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/GoogleDataTransportCCTSupport'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/GoogleUtilities'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/MDFInternationalization'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/MaterialComponents'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/Protobuf'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/leveldb-library'
ld: warning: directory not found for option '-F/Users/david/Library/Developer/Xcode/DerivedData/festivelo-axwalveswgznjdhkxlukavauewlb/Build/Products/Debug-iphoneos/nanopb'
ld: framework not found FirebaseAuth
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已验证我的 firebase 控制台设置正确,GoogleService-Info.plist 文件正确,并且 firebase.nativescript.json 正确:

{
    "external_push_client_only": false,
    "using_ios": true,
    "using_android": true,
    "firestore": false,
    "realtimedb": true,
    "authentication": true,
    "remote_config": false,
    "performance_monitoring": false,
    "messaging": true,
    "in_app_messaging": false,
    "crashlytics": false,
    "storage": false,
    "functions": false,
    "facebook_auth": false,
    "google_auth": false,
    "admob": false,
    "dynamic_links": false,
    "ml_kit": false
}

我已经卸载并重新安装了 iOS 平台,清理了 Xcode 的派生数据文件夹,并运行了 pod repo update。看起来 Xcode 正在尝试引入我没有使用的 firebase 组件,但我已经没有地方可以检查了。

问题:如何仅使用我实际使用的 firebase 组件获得干净的 Xcode 构建?

编辑:

我遵循了保罗的建议,但得到了以下信息:

$ pod install 
Analyzing dependencies
Downloading dependencies
Installing Firebase (6.10.0)
Installing FirebaseAnalyticsInterop (1.4.0)
Installing FirebaseAuth (6.3.0)
Installing FirebaseAuthInterop (1.0.0)
Installing FirebaseCore (6.3.1)
Installing FirebaseCoreDiagnostics (1.1.1)
Installing FirebaseCoreDiagnosticsInterop (1.0.0)
Installing FirebaseDatabase (6.1.1)
Installing FirebaseInstanceID (4.2.5)
Installing FirebaseMessaging (4.1.6)
Installing GTMSessionFetcher (1.2.2)
Installing GoogleDataTransport (3.0.1)
Installing GoogleDataTransportCCTSupport (1.2.1)
Installing GoogleMaps (3.5.0)
Installing GoogleUtilities (6.3.1)
Installing MDFInternationalization (2.0.0)
Installing MaterialComponents (84.6.0)
Installing Protobuf (3.10.0)
Installing leveldb-library (1.22)
Installing nanopb (0.3.901)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 20 total pods installed.

似乎问题来自 /platforms/ios/Pods/ 文件夹中的文件 .ns-plugins-build-data.json ,其中包括以下几行:

"nativescript-plugin-firebase": {
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/Info.plist": "52368d781d8c6dc3498bfadd4b59790b4cbe2aaa",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/Podfile": "7c68e0a5a4f17a95b5ca9863e503f66d4e5a9086",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSCrashlyticsLogger.framework/Headers/TNSCrashlyticsLogger.h": "5018cdbf78957b475d01e617e240debaf8310b53",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSCrashlyticsLogger.framework/Headers/TNSCrashlyticsLoggerWrapper.h": "274baa9f00a34ab70bf651d10cd37b857bcb6d58",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSCrashlyticsLogger.framework/Info.plist": "80f7ea9052045100d02c82667abcef6722b1fa72",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSCrashlyticsLogger.framework/Modules/module.modulemap": "edf7a712a23e415884ac6444185bfb62aa3a89c8",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/Headers/TNSMLKitCamera.h": "78ea6480dd4f5bbce5b2d49221c43a3f10737f81",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/Headers/TNSMLKitCameraView.h": "6463ba0cae804c84eb87373abda07cdb214d2e2d",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/Headers/TNSMLKitCameraViewDelegate.h": "b3296ea9a63cc873bdf7def8836795049e598ec5",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/Info.plist": "c8e012468aceb390d0d746386b639be7aae2461a",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/Modules/module.modulemap": "22d675cfcdcd0abd299e79c602de3eb9553de68c",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/beep.caf": "9f5c25a7e9f3d08c887fe8a35b9b4ff75508fb1d",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/build.xcconfig": "aa1b078da3b7e00f79fe499c04ca4f3e8b50fdc2",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSMLKitCamera.framework/TNSMLKitCamera": "34dd2c88baa6ce46695cfb29c4beb5b2a9fbe5f5",
    "/Users/david/Documents/NativeScriptProjects/festivelo/node_modules/nativescript-plugin-firebase/platforms/ios/TNSCrashlyticsLogger.framework/TNSCrashlyticsLogger": "d7275db8ad30a82844642689c0337cb86d2dbd44"
},

我不确定如何控制这个文件的内容。大概它应该与我实际使用的 firebase 组件相匹配。

标签: iosxcodefirebasecocoapodsnativescript

解决方案


这里有两个不同的问题。我通过打开 .xcworkspace 而不是 .xcodeproj 文件解决了构建问题,就像我之前所做的那样。

第二个问题是我将整个 firebase 插件包含在构建中,而不仅仅是我使用的组件。我将其视为 firebase 插件 GitHub 问题。


推荐阅读