We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am having this error logged... so i cannot get the token
2015-01-13 10:39:39.452 apnagent[2482:723049] registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
The text was updated successfully, but these errors were encountered:
In Swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. //ENABLE PUSH NOTIFICATIONS if (UIApplication.sharedApplication().respondsToSelector(Selector("registerForRemoteNotifications"))) { var types: UIUserNotificationType = UIUserNotificationType.Badge|UIUserNotificationType.Alert | UIUserNotificationType.Sound var settings: UIUserNotificationSettings = UIUserNotificationSettings( forTypes: types, categories: nil ) application.registerUserNotificationSettings( settings ) application.registerForRemoteNotifications() } // ios7 else { application.registerForRemoteNotificationTypes( UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.Alert ) } return true }
Sorry, something went wrong.
Solution:
// Substitute this in didFinishLaunchingWithOptions... // [[UIApplication sharedApplication] registerForRemoteNotificationTypes: // (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
// ...with this: [[UIApplication sharedApplication] respondsToSelector:("registerForRemoteNotifications")]; UIUserNotificationType *types = (UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound); UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications];
No branches or pull requests
I am having this error logged... so i cannot get the token
The text was updated successfully, but these errors were encountered: