美文网首页
程序切入后台后,再 杀死, 调用terminal 代理

程序切入后台后,再 杀死, 调用terminal 代理

作者: i诺离 | 来源:发表于2017-11-17 10:00 被阅读11次
  • 程序切入后台后,再 杀死, 调用terminal 代理
-(void)applicationDidEnterBackground:(UIApplication *)application {
    __block UIBackgroundTaskIdentifier _bgTask;
    _bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            if (_bgTask != UIBackgroundTaskInvalid)
            {
                [[UIApplication sharedApplication] endBackgroundTask:_bgTask];
                _bgTask = UIBackgroundTaskInvalid;
            }
        });
    }];
}

相关文章

网友评论

      本文标题:程序切入后台后,再 杀死, 调用terminal 代理

      本文链接:https://www.haomeiwen.com/subject/tesohxtx.html