![](/img/trans.png)
[英]didReceiveLocalNotification method not called in app delegate when app is in background [iOS6]
[英]didReceiveLocalNotification is not firing if app deleted from background when notification comes in ios
我設置了一個本地通知,該通知每隔一定的時間觸發一次,當我單擊橫幅時,將調用“ didReceiveLocalNotification”。現在,當我從后台刪除應用程序時,當我在橫幅上按Tab鍵時,通知又來了,但是這次是“ didReceiveLocalNotification” ”,不會被調用。在這種情況下,請告訴我如何觸發通知。
如果應用程序不在后台運行,那么didReceiveLocalNotification將不會調用,而是會調用應用程序didFinishLaunchingWithOptions:。 在啟動選項中,您可以檢查通知
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// If application is launched due to alarm notification, provide the option to snooze it.
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification)
{
// application is launched due to notification
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.