通過點擊通知獲取推送通知並打開應用後,在didFinishLaunchWithOptions
中接收nil
的可能原因是什麼?我已經仔細檢查過該應用已停止,而不僅僅是在後臺。而且nil
仍然總是寫入日誌。爲什麼launchOptions在收到推送通知後爲零?
我沒有做什麼特別的東西在我的didFinishLaunchWithOptions
,下面的代碼:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[MA init];
NSLog(@"%@", launchOptions);
if (!launchOptions) {
return YES;
}
id userInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
if (userInfo[@"aps"] && userInfo[@"id"]) {
MAResult* result = [[MA data] resultById:userInfo[@"id"]];
if (result) {
[((UINavigationController *)self.window.rootViewController) pushViewController:[[MATaskDetails alloc] initWithResults:result] animated:YES];
}
}
return YES;
}
你有什麼有效載荷? – null