OC申请后台运行时间
//申请后台运行程序时间(当程序进去后台时,单位分钟)
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication]beginBackgroundTaskWithExpirationHandler:nil];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(pushAction) userInfo:nil repeats:NO];
NSLog(@"%@",timer);
}
- (void)pushAction{
NSLog(@"申请后台运行时间,时间为0,点击home键,直接后台挂起程序");
}
posted on 2018-09-26 18:47 yucaijiang 阅读(363) 评论(0) 编辑 收藏 举报