From f37305bb807ed46079706b8ba34a67d5a459ab2a Mon Sep 17 00:00:00 2001 From: "wade.hawk" Date: Sat, 18 May 2019 01:26:04 +0900 Subject: [PATCH] Bug Fixed #164 --- Example/TLPhotoPicker/CustomCameraCell.swift | 4 ++-- TLPhotoPicker.podspec | 2 +- TLPhotoPicker/Classes/TLPhotosPickerViewController.swift | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Example/TLPhotoPicker/CustomCameraCell.swift b/Example/TLPhotoPicker/CustomCameraCell.swift index 776f255c..3dd8740c 100644 --- a/Example/TLPhotoPicker/CustomCameraCell.swift +++ b/Example/TLPhotoPicker/CustomCameraCell.swift @@ -27,7 +27,6 @@ class CustomCameraCell: TLPhotoCollectionViewCell, AVCaptureFileOutputRecordingD var videoDeviceInput: AVCaptureDeviceInput! @IBOutlet private weak var previewView: PreviewView! - override func awakeFromNib() { super.awakeFromNib() if Platform.isSimulator { @@ -103,7 +102,8 @@ class CustomCameraCell: TLPhotoCollectionViewCell, AVCaptureFileOutputRecordingD if Platform.isSimulator { return } - sessionQueue.async { + sessionQueue.async { [weak self] in + guard let `self` = self else { return } if self.setupResult == .success { self.session.stopRunning() self.isSessionRunning = self.session.isRunning diff --git a/TLPhotoPicker.podspec b/TLPhotoPicker.podspec index 7a9ec72c..36d6ddf0 100644 --- a/TLPhotoPicker.podspec +++ b/TLPhotoPicker.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'TLPhotoPicker' - s.version = '1.8.7' + s.version = '1.8.9' s.summary = 'multiple phassets picker for iOS lib. like facebook' # This description is used to generate tags and improve search results. diff --git a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift index 9260b82f..dd91f1be 100644 --- a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift +++ b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift @@ -859,7 +859,6 @@ extension TLPhotosPickerViewController: UICollectionViewDelegate,UICollectionVie }else{ cell.imageView?.image = self.cameraImage } - cell.willDisplayCell() return cell } guard let asset = collection.getTLAsset(at: indexPath) else { return cell } @@ -986,7 +985,11 @@ extension TLPhotosPickerViewController: UICollectionViewDelegate,UICollectionVie } public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { - if self.usedPrefetch, let cell = cell as? TLPhotoCollectionViewCell, let collection = self.focusedCollection, let asset = collection.getTLAsset(at: indexPath) { + guard let cell = cell as? TLPhotoCollectionViewCell else { + return + } + cell.willDisplayCell() + if self.usedPrefetch, let collection = self.focusedCollection, let asset = collection.getTLAsset(at: indexPath) { if let selectedAsset = getSelectedAssets(asset) { cell.selectedAsset = true cell.orderLabel?.text = "\(selectedAsset.selectedOrder)"