2016-03-01 84 views
1

如何實現警報作爲本地通知在應用我的示例代碼:如何在應用程序中實現本地通知警報?

UILocalNotification* localNotification = [[UILocalNotification alloc] init]; 
localNotification.fireDate = pickerDate; 
localNotification.alertBody = self.itemText.text; 
localNotification.alertAction = @"Show me the item"; 
localNotification.timeZone = [NSTimeZone defaultTimeZone]; 
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1; 

感謝

回答

0
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 

在你的代碼的末尾添加此&請務必選擇有效日期&時間通知開火。

相關問題