【发布时间】:2017-03-17 17:07:25
【问题描述】:
我正在尝试将通知的 iOS 处理程序迁移到 Firebase 服务器。在 appDelegate.cs 文件中,xamarin 网站 (https://components.xamarin.com/gettingstarted/firebaseioscloudmessaging) 上的文档是这样的步骤之一:
// Register your app for remote notifications.
if (UIDevice.CurrentDevice.CheckSystemVersion (10, 0)) {
// iOS 10 or later
var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
UNUserNotificationCenter.Current.RequestAuthorization (authOptions, (granted, error) => {
Console.WriteLine (granted);
});
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.Current.Delegate = this;
// For iOS 10 data message (sent via FCM)
Messaging.SharedInstance.RemoteMessageDelegate = this;
} else {
// iOS 9 or before
var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
var settings = UIUserNotificationSettings.GetSettingsForTypes (allNotificationTypes, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings (settings);
}
UIApplication.SharedApplication.RegisterForRemoteNotifications ();
两行代码,messaging.sharedinstance.... 和 UNUSerNotificationCenter.Current... 接收 appdelegate 工作负载。为了使 appdelegate 实现 Usernotificationcenterdelegate,这是可行的。但是,这不适用于 Firebase 消息委托。 firebase 消息委托无法识别。我已经安装了云消息包 (v1.2.1.1)、analytics (3.6.0)、Core (3.4.5) 和实例 ID (1.0.8)。这些包是通过 Nuget 包管理器安装的。
有人知道为什么找不到 FIRMessagingDelegate,或者这些版本的 iOS 包需要做一些具体的事情吗?
【问题讨论】:
标签: ios firebase xamarin firebase-cloud-messaging