AppDelegate内でプッシュ通知を受信し、バッジを更新した時に
iOS9.2.1のiPhone5では正常にバッジが表示
iOS8.4のiPhone6ではバッジが表示されない
正常に表示させたいのですが解決策が分からなく困っています。
以下AppDelegate内のコードになります。
lang
1func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 2 3 NSNotificationCenter.defaultCenter().addObserver(self, selector: "handlePushNotification:", name: "push", object: nil) 4 return true 5 } 6 7func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { 8 let notification = NSNotification(name: "push", object: nil, userInfo: userInfo) 9 NSNotificationCenter.defaultCenter().postNotification(notification) 10 } 11 12func handlePushNotification(notification: NSNotification) { 13 14 if let tabBarController = self.window?.rootViewController as? UITabBarController { 15 print("バッジ更新") 16 tabBarController.tabBar.items?[1].badgeValue = "3" 17 } 18
あなたの回答
tips
プレビュー