开发者

iphone iphone-sdk push-notification

Is there any way my iPhone application could get the content of the last push notification which was se开发者_运维技巧nt to it?

Basically I want to perform specific actions based on the notification type received.


In the push notification, you can send a "payload" which gets transferred to your app on open:

Your application shall get the "userInfo" (NSDictionary) as a param to didFinishLaunchingWithOptions() method.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Parameters
application
The application interested in the remote notification.
userInfo
A dictionary that contains information related to the remote notification, potentially including a badge number for the application icon, an alert sound, an alert message to display to the user, a notification identifier, and custom data. The provider originates it as a JSON-defined dictionary that iPhone OS converts to anNSDictionary object; the dictionary may contain only property-list objects plus NSNull.

To set the payload, see the Apple Push Notification Service Programming Guide. Basically, you can send any kind of info in there to help the app route the user to the correct spot internally.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜