ios - 更新Firebase程序包后,“InstanceID”不包含“SetApnsToken”的定义

标签 ios firebase xamarin xamarin.ios firebase-cloud-messaging

在我的Xamarin.iOS项目中,我更新了Firebase nuget程序包,完成更新后,我开始在此代码上出错

//You'll need this method if you set "FirebaseAppDelegateProxyEnabled": NO in GoogleService-Info.plist
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
    SISConst.PushInfo = new PushNotification();
    SISConst.PushInfo.DeviceID = deviceToken.ToString();
    NSUserDefaults.StandardUserDefaults.SetString(deviceToken.ToString(),"dToken");

#if DEBUG
    Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Sandbox);
#if RELEASE
    Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Prod);
}

下面的行显示错误
Firebase.InstanceID.InstanceId.SharedInstance.SetApnsToken(deviceToken, Firebase.InstanceID.ApnsTokenType.Sandbox);

请参阅屏幕截图以获取更多信息

enter image description here

我该如何解决这个问题?

最佳答案

几个小时后得到答案

if DEBUG
            Firebase.CloudMessaging.Messaging.SharedInstance.SetApnsToken(deviceToken, ApnsTokenType.Sandbox);
endif
if RELEASE
            Firebase.CloudMessaging.Messaging.SharedInstance.SetApnsToken(deviceToken,ApnsTokenType.Production);
endif

关于ios - 更新Firebase程序包后,“InstanceID”不包含“SetApnsToken”的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54648799/

相关文章:

ios - Xamarin.iOS - 使用 NSUserDefaults 在 UITableView 中保存选中状态

ios - WatchKit 如何在 Storyboard 中指定主要入口点?

ios - 在 UITableView 问题中搜索字典值和键并显示

java - ArrayList 未在 onChildAdded 函数内更新

ios - CocoaPods 找不到 pod "Firebase/Performance": when installed Firebase X in Ionic 5 的兼容版本

firebase - Firebase 中是否有(或考虑过)类似 'merge' 或 'batch' 设置的内容?

c# - 了解如何在 iOS Designer 中使用 "Container View"

ios - 在 iOS 8 中使用 Storyboard 时 FBLoginView 不显示

ios - UITableViewCell 更新模型的正确 MVC 方法?

android - 使用 AppCompatActivity 时 Toast 显示不佳