2 things you need to do for an iOS app agent
1. When the program starts, register the remote Notification Service, plainly: is to send a message to Apple, asked "my latest devicetoken is how much?".
Note: When registering for the first time, user authorization is required, that is, our common "xxx app" wants to send you push notifications
The specific code is as follows
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
Registering a remote Notification service
[Application Registerforremotenotificationtypes:uiremotenotificationtypebadge |
Uiremotenotificationtypesound |
Uiremotenotificationtypealert];
return YES;
}
2. Submit UserID + Devicetoken to the server.
The following callback method does not necessarily adjust: The network is not good, it will not be adjusted
-(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken
{
Submit UserID + Devicetoken to company server
The company server will look at this userid the latest commit devicetoken and the devicetoken stored in the database are the same. If not, update the Devicetoken in the database.
Write the code that submits the UserID + Devicetoken in curly braces
}
IOS Remote Push