app badge for turn based matches

Hi I am wondering what I need to do to get the app badge in my game app that indicates the number of turn based matches where it is my turn. I enabled push notifications in the app capability. No app badge. Anything else I need to do to support game center issued push notifications to appear as badge on my app icon? Thanks Barnski

Answered by Barnski in 161410022

I figured it out. In the AppDelegate, the app needs to register itself to receive push notifications. Then the icon badge immediately appeared and is now correctly managed by game center push notifications.


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        application.registerForRemoteNotifications()
        let types:UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
        application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: types, categories: nil))
        return true
    }
Accepted Answer

I figured it out. In the AppDelegate, the app needs to register itself to receive push notifications. Then the icon badge immediately appeared and is now correctly managed by game center push notifications.


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        application.registerForRemoteNotifications()
        let types:UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
        application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: types, categories: nil))
        return true
    }
app badge for turn based matches
 
 
Q