Push notification iOS 8.0及更高版本不支持xamarin RegisterForRemotionTificationTypes:

Push notification iOS 8.0及更高版本不支持xamarin RegisterForRemotionTificationTypes:,push-notification,xamarin,ios8,Push Notification,Xamarin,Ios8,我正在使用Xamarin开发iOS应用程序,但随着iOS 8的发布,我在注册推送通知时遇到了问题。在iOS 7 SDK下编写的代码中出现以下错误: iOS 8.0及更高版本不支持registerForRemoteNotificationTypes: 我知道,我需要使用“registerUserNotificationSettings”和“RegisterForRemotionTifications”,而不是使用已折旧的“RegisterForRemotionTypes()” 如果是在C#中使用X

我正在使用Xamarin开发iOS应用程序,但随着iOS 8的发布,我在注册推送通知时遇到了问题。在iOS 7 SDK下编写的代码中出现以下错误:

iOS 8.0及更高版本不支持registerForRemoteNotificationTypes:

我知道,我需要使用“registerUserNotificationSettings”和“RegisterForRemotionTifications”,而不是使用已折旧的“RegisterForRemotionTypes()

如果是在C#中使用Xamarin库,以下链接会有所帮助:

我在“UIApplication.SharedApplication”下查找了这些方法,但找不到它们……我找错地方了吗?(我的构建设置以iOS 8为目标)


任何帮助都将不胜感激

这应该可以做到:

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

事实证明,在我的观察中,RegisteredForremotentifications只会被调用一次。明智的做法是将设备令牌同时保存在设备和服务器上。