2010-01-26 161 views

回答

2

在推送通知,您就可以将被转移到你的应用程序上打开一个“有效载荷”:

您的应用程序将获得“用户信息”(NSDictionary中)作为参数去didFinishLaunchingWithOptions()方法。

- (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. 

要设置有效负载,请参阅Apple Push Notification Service Programming Guide。基本上,您可以在那里发送任何类型的信息,以帮助应用程序将用户路由到内部的正确位置。

+1

请记住,只有当用户在收到“推送”通知时允许该应用程序打开时才会这样。如果用户不允许打开该应用程序,则在应用程序的后续打开时,该信息将不会被应用程序接收。应用程序将不得不向发送服务器查询应该在关闭时收到的更新。 – Jann 2010-03-20 07:35:21