C# IOS远程通知在IOS 8后台不工作

C# IOS远程通知在IOS 8后台不工作,c#,ios,ios8,xamarin.ios,xamarin,C#,Ios,Ios8,Xamarin.ios,Xamarin,我一直在使用Xamarin.IOS,最近遇到了一个问题:当Iphone/Ipad在后台时,我试图接收远程通知负载。iOS7设备在后台或后台运行时似乎正常工作。但是,对于IOS 8设备,只有在触动警报横幅时才会调用DidReceiveEmotentification。我需要能够得到有效载荷时,警报横幅是没有接触和应用程序是在后台。为什么远程通知在IOS 7后台工作,而在IOS 8后台不工作。我可能做错了什么 if (UIDevice.CurrentDevice.SystemVersion [0]

我一直在使用Xamarin.IOS,最近遇到了一个问题:当Iphone/Ipad在后台时,我试图接收远程通知负载。iOS7设备在后台或后台运行时似乎正常工作。但是,对于IOS 8设备,只有在触动警报横幅时才会调用DidReceiveEmotentification。我需要能够得到有效载荷时,警报横幅是没有接触和应用程序是在后台。为什么远程通知在IOS 7后台工作,而在IOS 8后台不工作。我可能做错了什么

if (UIDevice.CurrentDevice.SystemVersion [0] >= '8')
    {
        UIUserNotificationType types = UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert;
        UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes (types, null);
        UIApplication.SharedApplication.RegisterUserNotificationSettings (settings);
    }
    else
    {
        UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge |                                                      
        UIRemoteNotificationType.Sound;
        UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (notificationTypes);
    } 

如果版本为iOS 8或更高版本,则需要调用RegisterForRemoteNotifications方法,如下所示:

if (UIDevice.CurrentDevice.SystemVersion [0] >= '8')
{
    UIUserNotificationType types = UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert;
    UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes (types, null);
    UIApplication.SharedApplication.RegisterUserNotificationSettings (settings);
    UIApplication.SharedApplication.RegisterForRemoteNotifications();
}