ios8 - Swift ios 8 issue not update app badge icon but its working in ios 9 Error - Attempting to badge the application icon but haven't received permission -
i have create 1 app on xcode 7 using swift language , , have app register push notification . problem in ios 8 , app ask allow pushnotification message in both (ios8 , ios9) app run on ios 8 return message attempting badge application icon haven't received permission user badge application when have open app time pushnotification in function ios8 , ios9
func application( application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject]) { // print("notification received2: \(userinfo)") application.applicationiconbadgenumber = 0;}
but when close app cant able see notification in ios8 working in ios9 here code
let settings = uiusernotificationsettings(fortypes: [.alert, .badge,.sound], categories: nil) application.registerusernotificationsettings( settings ) application.registerforremotenotifications()
what missing ios8 please give me solution
by nishant chandwani please me
if cfloat(uidevice.currentdevice().systemversion())! >= 8.0 { uiapplication.sharedapplication().registerusernotificationsettings(uiusernotificationsettings.settingsfortypes(([.sound, .alert, .badge]), categories: nil)) uiapplication.sharedapplication().registerforremotenotifications() } else { uiapplication.sharedapplication().registerforremotenotificationtypes(([.badge, .sound, .alert])) }
Comments
Post a Comment