Xamarin.ios 8推送通知

推送通知

使用iOS 8+您注册推送通知的方式已更改了一点。因此,如果您希望您的应用程序继续接收IOS 8及以上的推送通知,您需要调整您的注册:

var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound    | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null);UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);UIApplication.SharedApplication.RegisterForRemoteNotifications();

要继续支持iOS7和差点,您仍然可以在以前注册或仅使用以下线路:

if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)){    var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Sound        | UIUserNotificationType.Alert | UIUserNotificationType.Badge, null);    UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);    UIApplication.SharedApplication.RegisterForRemoteNotifications();}else{    const UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert                                                       | UIRemoteNotificationType.Badge                                                       | UIRemoteNotificationType.Sound;    UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);}

结论

我偶然发现了这个 Azure推送通知 轮毂教程。希望它对你有一些帮助。

Updated: