在推送通知中,您可以发送一个“有效负载”,它在打开时传输到您的应用程序:
您的应用程序应获取“userinfo”(nsdictionary)作为didFinishLaunchWithOptions()方法的参数。
- (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
.基本上,你可以在那里发送任何类型的信息来帮助应用程序在内部将用户路由到正确的位置。