首页 > 解决方案 > 无法让 Firebase 为 Xamarin Forms iOS 工作

问题描述

我在 Windows 上使用 Visual Studio 2019,使用 Xamarin Forms 开发适用于 Android 和 iOS 的应用程序。一切都是最新版本。

我正在尝试使用 Firebase 添加推送通知功能。我已经能够为 Android 应用程序实现此功能,但无论我做什么似乎都失败/不适用于 iOS。

我尝试使用 Xamarin.Firebase.iOS.CloudMessaging 和 Plugin.FirebasePushNotification 并获得相同的结果。从在 Visual Studio 中创建的基本应用程序开始,只要我为 iOS 项目添加基本代码,应用程序就会停止工作,并在 17 秒后运行任何项目代码(没有遇到断点)超时。

我还尝试下载此演示应用程序https://github.com/jfversluis/XFFCMPushNotificationsSample。我创建了我的 google-services.json (Android) 和 GoogleService-Info.plist (iOS) 版本。Android 应用程序运行,但 iOS 应用程序不运行(17 秒后超时)。

尝试了这么多不同的示例、示例、选项等 - 我完全不知道问题可能是什么。我刚接触 App 开发和 Xamarin Forms 对这种情况没有帮助!

我很感激我没有添加任何“我试过这个”代码,但我希望有人可以帮助我调试这个。Visual Studio 似乎没有显示任何内容,我可以从 iPhone 获得更多有用的信息吗?

编辑:

对于 iOS,

编辑 2:我已经收到一条错误消息,该消息在调用

FirebasePushNotificationManager.Initialize(options, true);

{System.NullReferenceException:对象引用未设置为对象的实例。在 /Users/runner/runners/2.169.1/work/1/s/Plugin.FirebasePushNotification/FirebasePushNotificationManager.ios.cs 中的 Plugin.FirebasePushNotification.FirebasePushNotificationManager.Initialize(Foundation.NSDictionary 选项,System.Boolean autoRegistration)[0x00029]: 141 在 MyApp.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication 应用程序,Foundation.NSDictionary 选项)[0x00014] 在 \MyKRing.iOS\AppDelegate.cs:34 }

标签: xamarin.formsxamarin.iosfirebase-cloud-messaging

解决方案


推荐阅读