longitachi / ZLPhotoBrowser

Wechat-like image picker. Support select photos, videos, gif and livePhoto. Support edit image and crop video. 微信样式的图片选择器,支持预览/相册内拍照及录视频、拖拽/滑动选择,编辑图片/视频,支持多语言国际化等功能;
MIT License
4.76k stars 963 forks source link

Big crash in ZLPhotoPreviewPopInteractiveTransition.startAnimate() #753

Closed jordaneckhardt closed 2 years ago

jordaneckhardt commented 2 years ago

Issue Description

This is a repetitive crash that occurred for several users an average of 3.5 times per user in our TestFlight.

EXC_BREAKPOINT 0x000000010a3bd05c

Crashed: com.apple.main-thread
0  ZLPhotoBrowser                 0x8d05c $s14ZLPhotoBrowser0A31PreviewPopInteractiveTransitionC12startAnimateyyF + 1272
1  ZLPhotoBrowser                 0x8cb48 $s14ZLPhotoBrowser0A31PreviewPopInteractiveTransitionC05starteF0yySo36UIViewControllerContextTransitioning_pFTo + 68
2  UIKitCore                      0x4b5d04 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 76
3  UIKitCore                      0x2e2250 +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 116
4  UIKitCore                      0x9b04b8 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.663 + 204
5  UIKitCore                      0x3e53b4 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 204
6  UIKitCore                      0x27b460 _UIViewControllerTransitioningRunCustomTransition + 628
7  UIKitCore                      0x377e1c -[UINavigationController _startCustomTransition:] + 3580
8  UIKitCore                      0x4d569c -[UINavigationController _startDeferredTransitionIfNeeded:] + 696
9  UIKitCore                      0x3aae1c -[UINavigationController __viewWillLayoutSubviews] + 168
10 UIKitCore                      0x2d25dc -[UILayoutContainerView layoutSubviews] + 228
11 UIKitCore                      0x18c17c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592
12 QuartzCore                     0x407fc CA::Layer::layout_if_needed(CA::Transaction*) + 532
13 QuartzCore                     0x32c60 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
14 QuartzCore                     0x475b4 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 452
15 QuartzCore                     0x504a8 CA::Transaction::commit() + 704
16 QuartzCore                     0x323a0 CA::Transaction::flush_as_runloop_observer(bool) + 88
17 UIKitCore                      0x53e6e0 _UIApplicationFlushCATransaction + 72
18 UIKitCore                      0x7d8d5c _UIUpdateSequenceRun + 84
19 UIKitCore                      0xe5fedc schedulerStepScheduledMainSection + 144
20 UIKitCore                      0xe5f6a4 runloopSourceCallback + 92
21 CoreFoundation                 0xbb414 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
22 CoreFoundation                 0xcc1a0 __CFRunLoopDoSource0 + 208
23 CoreFoundation                 0x5694 __CFRunLoopDoSources0 + 268
24 CoreFoundation                 0xb05c __CFRunLoopRun + 828
25 CoreFoundation                 0x1ebc8 CFRunLoopRunSpecific + 600
26 GraphicsServices               0x1374 GSEventRunModal + 164
27 UIKitCore                      0x514b58 -[UIApplication _run] + 1100
28 UIKitCore                      0x296090 UIApplicationMain + 364

Info

ZLPhotoBrowser version: 4.3.5 Device: iPhone 11, iPhone 13, iPhone 12 Pro Max, iPhone 7, iPhone 11 Pro Max Device version: iOS 15.4.1, iOS 15.5.0, iOS 15.6.0, iOS 15.6.1 Xcode version: Version 14.0 beta 6

Configuration code of ZLPhotoConfiguration

ZLPhotoConfiguration.default().maxRecordDuration = 120
ZLPhotoConfiguration.default().maxSelectCount = 6
ZLPhotoConfiguration.default().maxVideoSelectCount = 1
ZLPhotoConfiguration.default().maxSelectVideoDuration = 120
ZLPhotoConfiguration.default().allowEditVideo = true
ZLPhotoConfiguration.default().allowSelectOriginal = false
ZLPhotoConfiguration.default().useCustomCamera = false
ZLPhotoConfiguration.default().cameraConfiguration.videoExportType = .mp4
ZLPhotoUIConfiguration.default().bottomToolViewBtnNormalBgColor = .clear
ZLPhotoUIConfiguration.default().bottomToolViewBtnNormalBgColorOfPreviewVC = .clear
ZLPhotoUIConfiguration.default().indexLabelBgColor = .black

let imagePicker = ZLPhotoPreviewSheet(selectedAssets: assets)
imagePicker.selectImageBlock = { [weak self] (uiImages, phAssets, isOriginal) in
 ...
} 
jordaneckhardt commented 2 years ago

@longitachi this crash started happening recently. It happens a lot for our beta testers but I haven't reproduced it myself yet.

It is happening a lot.

jordaneckhardt commented 2 years ago

We found the crash in Xcode Organizer and it points to this line:

let cell = fromVC.collectionView.cellForItem(at: IndexPath(row: fromVC.currentIndex, section: 0)) as! ZLPreviewBaseCell

image

image

longitachi commented 2 years ago

v4.3.6 had fixed this crash. Please upgrade to v4.3.6.