Project to add push notification, after testing the local notification, found that the remote notification is not detected. Then you want to reset the authorization request.
Here's how to reset the authorization request:
Method One:
通用 - 还原 -抹掉所有内容和设置
But the first method is time-consuming, and erasing content is estimated to take a few 10 minutes. Then there is the second method.
Method Two:
Remove the app from your device
Shut down the device completely and reboot
Open settings, general-purpose date and time unplug device time faster than one day
Turn the device off again completely and restart
Installing your app now allows you to test all authorizations like a pure new process,
Check your app licensing options in Settings and reset all.
The code for the registration notice is attached:
In the Appdelegate Didfinishlaunchingwithoptions method, add the code:
UIApplication *app = [uiapplication sharedapplication]; Uiusernotificationsettings *settings = [Uiusernotificationsettings Settingsfortypes:uiusernotificationtypealert | Uiusernotificationtypebadge | Uiusernotificationtypesound Categories:nil]; if ([App Respondstoselector: @selector (registerusernotificationsettings:)]) { NSLog (@ "8.0 registration notice"); [App registerusernotificationsettings:settings]; } else { NSLog ("7.0 and below Registration notice"); [App Registerforremotenotificationtypes:uiusernotificationtypealert | Uiusernotificationtypebadge | Uiusernotificationtypesound]; }
For IOS8, a new didregisterusernotificationsettings method is added. If you want to register remotenotification, you need to add the registration code in this method:
if (IS_IOS8) { [[uiapplication sharedapplication] registerforremotenotifications]; }
Otherwise, if the registration notification is not completed, add
[[UIApplication sharedapplication] registerforremotenotifications]
Will cause the following warning:
Attempting to schedule a local notification ... with an alert but haven ' t received permission from the user to display a Lerts
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
About resetting an iOS app request push authorization request