Transferred from: http://blog.csdn.net/justinjing0612/article/details/8297168
Apple's push notification callback method has only one,
[HTML]View Plaincopy
- -(void) Application: (UIApplication *) application didreceiveremotenotification: (nsdictionary *) userInfo
- {
- NSLog (@ "received push message:%@", [[UserInfo objectforkey:@ "APS"] objectforkey:@ "alert"]);
- }
And this is a strange method.
The above dictionary "push test" is a message that is pushed over.
"1" is the icon's corner mark.
"Sound" is the voice of the push message, default is defaulted, this you can also customize.
Only some kind of operation can be, the other operation is not.
This particular operation is a callback to this method when you click on the status bar notification. Is that none of your other operations will be recalled.
Tested:
Only click on the status bar notification, and in the app normal operation in the case of Apple's push is OK, the others are not OK
In order to avoid this, only when the app opens, the app actively go to the server pull the data
。
To add: If we run the program on the computer, the project is in the running state, this method will be callback. If the item above the phone is not started, then this method will only be called when the notification bar is clicked, the Desktop app icon will not be called when clicked, this is the view of the blogger above.
APNS callback Method Didreceiveremotenotification