Firebase 插件无法在 IOS (Ionic) 上运行
Firebase Plugins not Working on IOS (Ionic)
我正在开发 Ionic 应用程序,IOS 应用程序和 Firebase/FCM 插件出现一些问题。
Android 应用程序 与安装的以下插件完美配合:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
至于 IOS 应用程序 我尝试了几个插件并且 none 正在运行:
Option 1:
ionic cordova plugin add cordova-plugin-fcm
npm install @ionic-native/fcm
应用程序构建成功,但在 iPhone 上启动时失败。调试时,我收到此错误消息:
Terminating app due to uncaught exception 'com.firebase.core', reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.'
Option 2:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
使用此插件构建时,我在 xCode 中收到以下错误:
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/walid/Library/Developer/Xcode/DerivedData/Nutripro-aabwvacmftjwnefthwnyidfyxswx/Build/Intermediates.noindex/ArchiveIntermediates/Nutripro/IntermediateBuildFilesPath/Nutripro.build/Release-iphoneos/Nutripro.build/Objects-normal/arm64/FCMPlugin.o /Users/walid/Documents/www/nutripro/platforms/ios/Nutripro/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
我搜索了很多以找到解决此错误的方法,但找不到。
Option 3:
ionic cordova plugin add cordova-plugin-firebase
npm install @ionic-native/firebase
我可以使用这个插件成功构建一个应用程序,我可以在我的 iPhone 上 运行 它并生成一个令牌,我可以正常接收推送通知。
但是这里的问题发生在将应用程序上传到应用程序商店时
- 存档于 xCode 成功
- 当 Distributing/Uploading 应用程序时,出现以下错误:
ERROR ITMS-90771: "Missing Info.plist value. The Info.plist key 'BGTaskSchedulerPermittedIdentifiers' must contain a list of identifiers used to submit and handle tasks when 'UIBackgroundModes' has a value of 'processing'. For more information, refer to the Information Property List Key Reference at https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html."
我搜索了 Internet,发现 this article 说明我必须将以下内容添加到我的 info.plist 文件中
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.nutripro.mobile</string>
</array>
添加并重新提交我的申请后,我收到了一封来自 Apple 的电子邮件
Dear Developer,
We identified one or more issues with a recent delivery for your app, "NutriPro" 1.1.11 (1.1.11). Please correct the following issues, then upload again.
ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Best regards,
The App Store Team
如果我删除插件,应用程序正在上传并获得批准。
奇怪的是@ionic-native/firebase 上的文档说他们摆脱了 UIWebView 并正在使用 WKWebView
N.B:在每个选项之后,我正在卸载已安装的包和节点模块,我正在删除平台文件夹。
你们知道我该如何解决这个问题吗?将近 1 周以来,我一直在努力寻找解决方案,但我找不到任何解决方案!
经过大量的研究和不成功的尝试,我找到了解决方案。
对于Android,我正在使用fcm-with-dependecy-updated
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
对于IOS,我正在使用firebase-messaging
ionic cordova plugin add cordova-plugin-firebase-messaging
npm install @ionic-native/firebase-messaging
我找到了解决方案。
rm -rf platforms/android
cordova plugin remove cordova-plugin-firebase
安装这个插件firebase-lib
For cordova-cli >= 9.x.x && (cordava-ios >= 5.0.1 || cordava-android >= 8.x.x) .通过 运行:
使用最新的主要版本
cordova plugin add cordova-plugin-firebase-lib
For cordova-cli <= 8.1.1 && (cordava-ios <= 4.5.5 || cordova-android >= 8.x.x) 使用v4.x 由 运行 发布:
cordova plugin add cordova-plugin-firebase-lib@4.1.0 --save
对于 cordova-cli <= 7.1.0 && (cordava-ios <= 4.5.5 || cordova-android <= 7.1.4)。 运行 在您的终端中输入以下内容:
cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save
Androidx
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
对于 cocoaPods
If you are building your app using Xcode, please open platform/ios/my-cordova-project.xcworkspace instead of platform/ios/my-cordova-project.xcodeproj so that the Xcode can load both Cordova app & the Pods.
Your repo needs to be up to date. To keep it up to date, run pod repo update anywhere in your terminal.
我正在开发 Ionic 应用程序,IOS 应用程序和 Firebase/FCM 插件出现一些问题。
Android 应用程序 与安装的以下插件完美配合:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
至于 IOS 应用程序 我尝试了几个插件并且 none 正在运行:
Option 1:
ionic cordova plugin add cordova-plugin-fcm
npm install @ionic-native/fcm
应用程序构建成功,但在 iPhone 上启动时失败。调试时,我收到此错误消息:
Terminating app due to uncaught exception 'com.firebase.core', reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.'
Option 2:
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
使用此插件构建时,我在 xCode 中收到以下错误:
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/walid/Library/Developer/Xcode/DerivedData/Nutripro-aabwvacmftjwnefthwnyidfyxswx/Build/Intermediates.noindex/ArchiveIntermediates/Nutripro/IntermediateBuildFilesPath/Nutripro.build/Release-iphoneos/Nutripro.build/Objects-normal/arm64/FCMPlugin.o /Users/walid/Documents/www/nutripro/platforms/ios/Nutripro/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
我搜索了很多以找到解决此错误的方法,但找不到。
Option 3:
ionic cordova plugin add cordova-plugin-firebase
npm install @ionic-native/firebase
我可以使用这个插件成功构建一个应用程序,我可以在我的 iPhone 上 运行 它并生成一个令牌,我可以正常接收推送通知。 但是这里的问题发生在将应用程序上传到应用程序商店时
- 存档于 xCode 成功
- 当 Distributing/Uploading 应用程序时,出现以下错误:
ERROR ITMS-90771: "Missing Info.plist value. The Info.plist key 'BGTaskSchedulerPermittedIdentifiers' must contain a list of identifiers used to submit and handle tasks when 'UIBackgroundModes' has a value of 'processing'. For more information, refer to the Information Property List Key Reference at https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html."
我搜索了 Internet,发现 this article 说明我必须将以下内容添加到我的 info.plist 文件中
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.nutripro.mobile</string>
</array>
添加并重新提交我的申请后,我收到了一封来自 Apple 的电子邮件
Dear Developer,
We identified one or more issues with a recent delivery for your app, "NutriPro" 1.1.11 (1.1.11). Please correct the following issues, then upload again.
ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
Best regards,
The App Store Team
如果我删除插件,应用程序正在上传并获得批准。
奇怪的是@ionic-native/firebase 上的文档说他们摆脱了 UIWebView 并正在使用 WKWebView
N.B:在每个选项之后,我正在卸载已安装的包和节点模块,我正在删除平台文件夹。
你们知道我该如何解决这个问题吗?将近 1 周以来,我一直在努力寻找解决方案,但我找不到任何解决方案!
经过大量的研究和不成功的尝试,我找到了解决方案。
对于Android,我正在使用fcm-with-dependecy-updated
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated
npm install @ionic-native/fcm
对于IOS,我正在使用firebase-messaging
ionic cordova plugin add cordova-plugin-firebase-messaging
npm install @ionic-native/firebase-messaging
我找到了解决方案。
rm -rf platforms/android
cordova plugin remove cordova-plugin-firebase
安装这个插件firebase-lib
For cordova-cli >= 9.x.x && (cordava-ios >= 5.0.1 || cordava-android >= 8.x.x) .通过 运行:
使用最新的主要版本cordova plugin add cordova-plugin-firebase-lib
For cordova-cli <= 8.1.1 && (cordava-ios <= 4.5.5 || cordova-android >= 8.x.x) 使用v4.x 由 运行 发布:
cordova plugin add cordova-plugin-firebase-lib@4.1.0 --save
对于 cordova-cli <= 7.1.0 && (cordava-ios <= 4.5.5 || cordova-android <= 7.1.4)。 运行 在您的终端中输入以下内容:
cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save
Androidx
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
对于 cocoaPods
If you are building your app using Xcode, please open platform/ios/my-cordova-project.xcworkspace instead of platform/ios/my-cordova-project.xcodeproj so that the Xcode can load both Cordova app & the Pods. Your repo needs to be up to date. To keep it up to date, run pod repo update anywhere in your terminal.