ios 添加本地通知
在Appdelegate.m的回调函数
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSDate *alertTime = [[NSDate date]
dateByAddingTimeInterval:10];
UIApplication* app = [UIApplication sharedApplication];
UILocalNotification* notify = [[UILocalNotification alloc]
init];
if (notify)
{
notify.fireDate = alertTime;
notify.timeZone = [NSTimeZone defaultTimeZone];
notify.repeatInterval = 0;
notify.soundName = @"bell_tree.mp3";
notify.alertBody = @"Staff meeting in 30 minutes";
[app scheduleLocalNotification:notifyAlarm];
}
}