기기 잠금 문제가 있습니다. 내 앱이 실행 중이고 기기가 잠긴 경우 내 앱도 작동하지 않습니다. 기기가 잠긴 경우에도 앱이 작동되기를 원합니다. 다음 내 코드가 같이이 들어화면이 잠길 때 앱 실행 허용 방법
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
background = YES;
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if (background) {
StressFreeAlarmViewController *alarmController=[[StressFreeAlarmViewController alloc] initWithNibName:@"StressFreeAlarmViewController" bundle:nil];
[alarmController setTimer:[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updatingApp) userInfo:nil repeats:YES]];
background=NO;
}
});
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
background = NO;
}