2016-03-04 68 views

回答

0

中可以完美工作您可以使用[[UIApplication sharedApplication] scheduledLocalNotifications];獲取先前計劃的所有通知。如果你想有一些額外的信息通知您可以使用userInfo財產

for (UILocalNotification *notification in [[UIApplication sharedApplication] scheduledLocalNotifications]) { 
    // Handling codes goes here. 
} 

:這樣你就可以循環處理這些運行此方法返回一個NSArray實例。這是一個字典,用於存儲通知中的附加信息。您可以設置它是這樣的:

notification.userInfo = // The dictionary goes here. 

所以現在你可以這樣做:

for (UILocalNotification *notification in [[UIApplication sharedApplication] scheduledLocalNotifications]) { 
    NSDictionary *userInfo = notification.userInfo; 
    // Handling codes goes here. Now you can use the user info dictionary to 
    // get what you stored into the userInfo dictionary when you are 
    // initializing the user info. 
} 

在這之後,你可以得到所有的信息,你可以在UIAlertView出示。

要撥打上面這些代碼在應用啓動,你可以用兩種方法:

-application:didFinishLaunchingWithOptions: 

-applicationDidBecomeActive: 

希望這有助於。

+0

但如果沒有設置重複間隔,那麼該特定的通知會在發射後從預定數組中刪除...那麼我怎樣才能得到通知被解僱並且沒有重複間隔設置... –

+0

@HardikAmal看看這個問題:http://stackoverflow.com/questions/22728179/how-to-get-already-fired-uilocalnotification –

相關問題