Handle payload when launching application from alert view of push notification?
I would like to save the payload information in SQLite of iPhone when user launches ap开发者_如何学编程plication from alert view of push notification.
Have a look at [application:didReceiveRemoteNotification:][1]
that's the method called when a remote notification is received.
Your custom data will be on the userInfo
dictionary:
The
userInfo
dictionary may also have custom data defined by the provider according to the JSON schema. The properties for custom data should be specified at the same level as the aps dictionary. However, custom-defined properties should not be used for mass data transport because there is a strict size limit per notification (256 bytes) and delivery is not guaranteed.
If the application is louched by the notification, you will need to handle the notification on the method application:didFinishLaunchingWithOptions:
, on this case the payload will be on launchOptions
.
If you implement
application:didFinishLaunchingWithOptions:
to handle an incoming push notification that causes the launch of the application, this method is not invoked for that push notification.
精彩评论