我正在使用叠加视图制作视频捕捉功能。现在我想在UIApplicationDidEnterBackgroundNotification中调用stopVideoCapture方法。但“stopVideoCapture”方法始终失败,并显示错误消息“/ var / mobile / Media / PhotoData / takingvideo activity indicator已清除”。
请告诉我这是什么问题。
以下是UIApplicationDidEnterBackgroundNotification
中调用的代码UIApplication *app = [UIApplication sharedApplication];
self.bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if (isRecording) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.imagePickerController stopVideoCapture];
});
}
[NSThread sleepForTimeInterval:5];
[app endBackgroundTask:self.bgTask];
self.bgTask = UIBackgroundTaskInvalid;
});