0
如果應用程序不在後臺,則會發送推送通知。點擊啓動按鈕不會顯示推送通知,它只會打開應用程序,打開推送通知時,我們必須再次點擊通知任務欄中的推送通知。任何啓動的方式,我們也可以顯示通知?如何處理應用程序未在後臺運行時的推送通知
如果應用程序不在後臺,則會發送推送通知。點擊啓動按鈕不會顯示推送通知,它只會打開應用程序,打開推送通知時,我們必須再次點擊通知任務欄中的推送通知。任何啓動的方式,我們也可以顯示通知?如何處理應用程序未在後臺運行時的推送通知
已解決。回答是:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSDictionary *tmpDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
//if tmpDic is not nil, then your app is launched due to an APNs push, therefore check this NSDictionary for further information
if (tmpDic != nil) {
NSLog(@" - launch options dict has something ");
NSLog(@" - badge number is %@ ", [[tmpDic objectForKey:@"aps"] objectForKey:@"badge"]);
NSLog(@" - ");
}
已解決。請參閱:http://stackoverflow.com/questions/4782352/how-can-i-handle-push-notification-when-my-app-is-not-running – Inder 2012-08-08 11:25:15