We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
让程序在后台长久运行的示例代码如下:
- (void)applicationDidEnterBackground:(UIApplication *)application { [self beingBackgroundUpdateTask]; //在这里加上你需要长久运行的代码 [self endBackgroundUpdateTask]; } - (void)beingBackgroundUpdateTask { self.backgroundUpdateTask = [[UIApplication shareApplication] beginBackgroundTaskWithExpirationHandler:^{ [self endBackgroundUpdateTask]; }]; } - (void)endBackgroundUpdateTask { [[UIApplication sharedApplication] endBackgroundTask:self.backgroundUpdateTask]; self.backgroundUpdateTask = UIBackgroundTaskInvalid; }
1.作者第一个方法是不是想写成beginBackgroundUpdateTask以与end对应啊? 2.在beingBackgroundUpdateTask的expirationHandler中有调用endBackgroundUpdateTask,而在applicationDidEnterBackground中也有调用,这样重复调用不会有问题么?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
让程序在后台长久运行的示例代码如下:
1.作者第一个方法是不是想写成beginBackgroundUpdateTask以与end对应啊?
2.在beingBackgroundUpdateTask的expirationHandler中有调用endBackgroundUpdateTask,而在applicationDidEnterBackground中也有调用,这样重复调用不会有问题么?
The text was updated successfully, but these errors were encountered: