iOS 平台上的 Xamarin Forms 未收到 Appcenter 推送通知

Appcenter push notifications not received by Xamarin Forms on iOS platform

我已经在 ASP.Net Core Web API 上使用 AppCenter 实现了推送通知。 服务器正在向负责向每个平台推送通知的 AppCenter 发送 HTTP 请求 Android & iOS.

移动应用程序是使用 Xamarin Forms 开发的。 我已遵循 Microsoft 文档 here

Xamarin Android 应用程序正在接收每个推送通知,就像一个魅力。

问题出在 Xamarin iOS 应用程序上。设备没有收到任何推送通知。

这是我所做的 iOS 设置:

然后,我已经在生产模式下成功将应用发布到 TestFligth。

启动应用程序时,我通过调用方法 AppCenter.GetInstallIdAsync() 获取应用中心设备 InstallId。

最后,发送推送通知时,没有任何反应。而且我没有任何日志来搜索问题。

有什么我遗漏的吗?

AppCenter 为每个平台提供了不同的AppSecret。 你应该这样做:

        if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
        {
            //Start AppCenter Push notification with iOS app secret
            AppCenter.Start("xxxxxxxxxxxxxxxxxxxxxxx", typeof(Push));
        }
        else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.UWP)
        {
            //Start AppCenter Push notification with UWP app secret
            AppCenter.Start("xxxxxxxxxxxxxxxxxxxxxxx", typeof(Push));
        }
        else if(Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android)
        {
            //Start AppCenter Push notification with Android app secret
            AppCenter.Start("xxxxxxxxxxxxxxxxxxxxxxx", typeof(Push));
        }