我在iphone上實現了帶打盹功能的鬧鈴應用程序。本地通知設置正確。當我選擇特定時間時,它在該特定時間觸發,顯示2個按鈕關閉並查看.i將視圖按鈕重新命名爲貪睡,以便當用戶點擊貪睡時,通知將在1分鐘後重復。但是,當點擊貪睡按鈕時,它有問題,它會在控制檯中正確顯示,它會在1分鐘後重復從目前的時間,但通知不會在控制檯中重複。可能是什麼問題。請幫我解決這個問題。這是我的代碼。如何調用iphone上的本地通知的打盹功能
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
NSLog(@"Recieved local Notifications %@",notification.fireDate);
NSDate *date=[notification.fireDate dateByAddingTimeInterval:60];
NSLog(@"date After interval is %@",date);
UILocalNotification *notif=[[UILocalNotification alloc]init];
notif.fireDate=date;
NSLog(@"new notification:%@",notif.fireDate);
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
application.applicationIconBadgeNumber = 0;
}
in the didreceive notification i have added because when the snooze button is clicked i want the 1 minute time interval notification to be set and called.
我對你已經解釋了什麼感到困惑。我想我已經像你說的那樣做了。如果我錯了,請幫助我。你可以提供一些虛擬代碼 – Rocky
你可以在下面的鏈接中找到示例示例http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html – Srinivas