swift2 - My app cannot generate device token -
suddenly app cannot generate device token. created app receive remote push notification, thje app worked well, today app dont generate device token, run code on xcode , dont generate token. no delegates method called. dont change , dont work more. function didregisterforremotenotificationswithdevicetoken dont work. look:
func application(application: uiapplication, didregisterforremotenotificationswithdevicetoken devicetoken: nsdata) { print(devicetoken) }
dont print nothing
this function nothing:
func application(application: uiapplication, didfailtoregisterforremotenotificationswitherror error: nserror) { print(error) } func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. let types:uiusernotificationtype = [uiusernotificationtype.alert, uiusernotificationtype.badge, uiusernotificationtype.sound] application.registerusernotificationsettings(uiusernotificationsettings(fortypes: types, categories: [newscategory])) return true }
why problem? how can fix it?
you have call application.registerforremotenotifications()
in application:didfinishlaunchingwithoptions
after registering settings.
Comments
Post a Comment