SilenceLove / HXPHPicker

Photo/Video Selector-Supports LivePhoto, GIF selection, online download of resources on iCloud, and editing of photos/videos
MIT License
364 stars 74 forks source link

录制视频点击完成崩溃 #65

Open ZWP233 opened 2 years ago

ZWP233 commented 2 years ago

在后台线程中改变UI布局

DispatchQueue.global().async { let asset: Any let mediaType: PHAssetMediaType let photoAsset: PhotoAsset switch result { case .image(let image): asset = image mediaType = .image photoAsset = .init(localImageAsset: .init(image: image)) case .video(let videoURL): asset = videoURL mediaType = .video photoAsset = .init(localVideoAsset: .init(videoURL: videoURL)) } var canSelect = false if !picker.canSelectAsset(for: photoAsset, showHUD: true) { if !didDismiss { DispatchQueue.main.sync { cameraController.dismiss(animated: true) } } canSelect = true } if self.config.saveSystemAlbum { self.saveSystemAlbum( for: asset, mediaType: mediaType, location: location ) { [weak self] in self?.cameraControllerDismiss(canSelect) } return } self.addedCameraPhotoAsset( photoAsset ) { [weak self] in self?.cameraControllerDismiss(canSelect) } }

PacoPacoPakitor commented 2 years ago

在主线程更新UI

DispatchQueue.main.async { //* 更新操作写这里 }