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

时间:2019-02-12 11:12:04

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

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

Sub ProtectionOptions()

    ActiveSheet.Unprotect Password:="riccowendy"

    'Allow cells to be formatted on a protected worksheet.
    If ActiveSheet.Protection.AllowFormattingCells = False Then
        ActiveSheet.Protect AllowFormattingCells:=True
    End If
    ActiveSheet.Protect Password:="riccowendy", UserInterfaceOnly:=True

 MsgBox "Cells can be formatted on this protected worksheet."

End Sub

下面显示错误的行

//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);
}

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

enter image description here

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

几个小时后得到答案

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