Tag: 闹钟

用EKEvent在iPhone中播放闹钟

我正在使用EKEvent类存储事件的应用程序,我希望我的应用程序在发生事件时触发警报。 我不知道如何在iPhone上播放闹钟。

ios nstimer在后台运行检查报警时间等于当前时间并播放audio

我GOOGLE了几个小时,但无法find任何信息,如果有任何方式来保持运行NSTimer活动时,应用程序在后台运行? 请帮助我,当应用程序是背景,然后一个function运行,每秒检查报警时间等于当前时间,然后播放audio,并打开closures报警页面如果有人知道闹钟应用程序开源,并在后台运行,请与我分享在这里,我尝试这个,但是这不起作用 – (void)applicationDidEnterBackground:(UIApplication *)application { inBackground=YES; UIApplication* app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }]; // Start the long-running task and return immediately. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ while (inBackground == YES) { [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(checkAlert) userInfo:nil repeats:YES]; } [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }); } -(void)checkAlert { NSLog(@"Chalaaaaaa"); […]