0
点赞
收藏
分享

微信扫一扫

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键,直接后台挂起程序");
}

举报

相关推荐

0 条评论