如何在接收到推送通知并从非运行状态启动应用程序时读取aps有效内容。 这是我试过的。 在端应用程序委托类,在一侧的功能如何在应用程序未启动时读取应用程序启动时的aps有效载荷
FinishedLaunching (UIApplication app, NSDictionary options)
if (options != null){
if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)){
NSDictionary userInfo =(NSDictionary)options[UIApplication.LaunchOptionsRemoteNotificationKey];
if (userInfo != null){
if (null != options && options.ContainsKey(new NSString("aps")))
{
NSDictionary aps = options.ObjectForKey(new NSString("aps")) as NSDictionary;
if (aps.ContainsKey(new NSString("title")))
title = (aps[new NSString("title")] as NSString).ToString();
}
}
}
}
但我无法读取数据。但是,如果应用程序处于运行状态(启用/禁用),我能够从方法
ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
我能够检测启动是否从推发生或不会形成LaunchOptionsRemoteNotificationKey。但无法从apns载荷读取任何数据 – TutuGeorge
您能否在此处粘贴您的apns载荷? –