0
我知道這是一個已經回答的問題。Push Parse - launchOptions在null中didFinishLaunchingWithOptions
但在閱讀了很多消息後,我的問題仍然存在。
使用解析我發送此JSON推:
{"aps" : { "alert" : "text msg", "badge" : 1, "sound" : "chime" }, "_3Y" : "0"}
如果應用程序是活動的,則是所有的權利,USERINFO正確地接收我的數據:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[PFPush handlePush:userInfo];
...
}
如果應用程序是空閒,徽章並出現文字通知,但是:
如果我點擊通知欄上的文本,應用程序啓動並且我收到推送
如果我點擊徽章,應用程序啓動,但didFinishLaunchingWithOptions中的launchOptions爲null!
這是我didFinishLaunchingWithOptions方法測試代碼:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
NSDictionary *aPushNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
// NSDictionary* aPushNotification = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
NSString *test = [aPushNotification objectForKey:@"_3Y"];
[[[UIAlertView alloc] initWithTitle:test message:[aPushNotification description] delegate:NULL cancelButtonTitle:NSLocalizedString(@"LOC018", @"Ok") otherButtonTitles:nil, nil] show];
...
}
也許是一個解析的問題?
任何幫助將不勝感激..
在此先感謝!
您能否爲此提供解決方案?我正面臨着launchOptions = nil的這個問題。 – iDeveloper