在我的 flutter 应用程序中,我通过 Firebase 身份验证集成了 facebook 登录。
我也有不同的 Dev 和 Prod 环境。
这在 Android 和我的 iOS Debug-prod 模式下运行良好。但是,当我构建并发布到 Testflight 时,应用程序因 Facebook 登录而崩溃,下面是在 Firebase Crashlytics 上看到的错误:
fb is not registered as a URL scheme. Please add it in your Info.plist
看起来很简单。但是,我确实在我的 Release-prod.xcconfig 中提到了 URL 方案,并将其包含在我的 info.plist 中(如上所述,在 Debug模式下这可以正常工作)
发布产品.xcconfig:
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
FACEBOOK_URL_SCHEME=fbxxxxxxxxxxx
FACEBOOK_APP_ID=xxxxxxxxxxxxxxx
DISPLAY_NAME=AppName
Info.plist(相关部分):
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>$(FACEBOOK_URL_SCHEME)</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.xxxx---xxx---</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FacebookAppID</key>
<string>$(FACEBOOK_APP_ID)</string>
<key>FacebookDisplayName</key>
<string>AppName</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
其他需要注意的要点(如果相关):我使用 Xcode 自动进行代码设计,但尚未使用任何 CI/CD 工具
我希望它在构建后也能无缝运行。我哪里错了?请帮忙
最佳答案
后来我发现我的 Scheme 的“Archive”设置指向不正确的 xcconfig。
我将其更改为 Release-prod 并且有效
关于iOS 构建后 Facebook 登录不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57650852/