0
我是iphone新手,我正在使用下面的代码,在这里本地通知不会在10秒内触发以及重复间隔也不起作用,它不会在每个通知中显示second.After1分钟firedate通话和以同样的方式重复间隔适用于每一个minute.how可以设置重复间隔为每15 sec.If有人知道这个请大家帮我...以自定义时间间隔显示本地通知
- (void)applicationDidEnterBackground:(UIApplication *)application {
NSLog(@"1");
NSTimeInterval interval = 10;
NSDate *alertTime = [NSDate dateWithTimeIntervalSinceNow:interval];
UIApplication* app = [UIApplication sharedApplication];
UILocalNotification* notifyAlarm = [[UILocalNotification alloc] init];
if (notifyAlarm){
notifyAlarm.fireDate = alertTime;
notifyAlarm.alertAction = @"Message";
notifyAlarm.alertBody = @"Alert";
notifyAlarm.hasAction = YES;
notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
notifyAlarm.repeatInterval = NSSecondCalendarUnit;
// timer = [[NSTimer alloc]initWithFireDate:alertTime interval:interval target:self selector:@selector(sendRequest) userInfo:nil repeats:YES];
[app scheduleLocalNotification:notifyAlarm];
}
你不会给你清晰的想法? – Dev