JiongXing / PhotoBrowser

Elegant photo browser in Swift. 图片与视频浏览器。
MIT License
1.31k stars 206 forks source link

1.2%的崩溃概率:$s14JXPhotoBrowser0aB12FadeAnimatorC17animateTransition5usingySo36UIViewControllerContextTransitioning_p_tF #176

Closed Jaylin0920 closed 4 years ago

Jaylin0920 commented 4 years ago

崩溃概率:1.2% pod版本:pod 'JXPhotoBrowser', '3.0.9'

使用方法:

let browser = JXPhotoBrowser.init()
        browser.pageIndex = pageIndex
        browser.numberOfItems = {
            MMPhotoBrowserManager.shared.imageArray.count
        }
        browser.reloadCellAtIndex = { context in
            MMPhotoBrowserManager.shared.reloadCell(cell: context.cell, index: context.index, currentIndex: context.currentIndex)
        }
        browser.show(method: .push(inNC: nil))
Jaylin0920 commented 4 years ago

崩溃堆栈

已崩溃:com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000800000020
0
libobjc.A.dylib
objc_retain + 16
1
JXPhotoBrowser
$s14JXPhotoBrowser0aB12FadeAnimatorC17animateTransition5usingySo36UIViewControllerContextTransitioning_p_tF + 112
2
JXPhotoBrowser
$s14JXPhotoBrowser0aB12FadeAnimatorC17animateTransition5usingySo36UIViewControllerContextTransitioning_p_tFTo + 44
3
UIKitCore
___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 56
4
UIKitCore
+[UIInputResponderController _pinInputViewsForInputResponderController:onBehalfOfResponder:duringBlock:] + 104
5
UIKitCore
___UIViewControllerTransitioningRunCustomTransition_block_invoke.645 + 176
6
UIKitCore
+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 172
7
UIKitCore
_UIViewControllerTransitioningRunCustomTransition + 580
8
UIKitCore
-[UINavigationController _startCustomTransition:] + 3252
9
UIKitCore
-[UINavigationController _startDeferredTransitionIfNeeded:] + 680
10
UIKitCore
-[UINavigationController __viewWillLayoutSubviews] + 164
11
UIKitCore
-[UILayoutContainerView layoutSubviews] + 224
12
UIKitCore
-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
13
QuartzCore
-[CALayer layoutSublayers] + 284
14
QuartzCore
CA::Layer::layout_if_needed(CA::Transaction*) + 480
15
QuartzCore
CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
16
QuartzCore
CA::Context::commit_transaction(CA::Transaction*, double) + 304
17
QuartzCore
CA::Transaction::commit() + 676
18
QuartzCore
CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
19
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
20
CoreFoundation
__CFRunLoopDoObservers + 416
21
CoreFoundation
__CFRunLoopRun + 1308
22
CoreFoundation
CFRunLoopRunSpecific + 464
23
GraphicsServices
GSEventRunModal + 104
24
UIKitCore
UIApplicationMain + 1936
25
Olaa
MMAppDelegate.swift - 第 12 行
main + 12
26
libdyld.dylib
start + 4
Jaylin0920 commented 4 years ago

复现步骤:快速进出图片浏览器,偶发出现崩溃 崩溃位置:如图所示 222

Jaylin0920 commented 4 years ago

崩溃概率太高了,楼主能优化下么

JiongXing commented 4 years ago

好的感谢反馈,这几天发新版

JiongXing commented 4 years ago

你好,我刚更新了代码,版本3.1.0,虽然我还是没能复现出来,但是从根源上杜绝了这个空指针... 有空更新看看吧~

Jaylin0920 commented 4 years ago

感谢及时更新,我明天就试试

Jaylin0920 commented 4 years ago

我试了3.1.0,有新的bug

Jaylin0920 commented 4 years ago

图片浏览器打卡图片后,会给我原有的Controller中加入一层图片 以下是层级关系效果图

WeChat6e50e476c65138e709186d7459f08d32

我也录了个小视频,在zip中可以看到 111.mov.zip

JiongXing commented 4 years ago

我看下

Jaylin0920 commented 4 years ago

关于解决关联对象的crash的那个,我看楼主主要更新的位置是:

private var isForShowKey = "isForShowKey"
private var photoBrowserKey = "photoBrowserKey"

然后在楼主更新这个的期间,我也尝试了这么修改,给关联对象的Key,改成唯一的固定字符串,然后我上线了一个版本进行试验。发现这个修改并没有解决crash的问题

JiongXing commented 4 years ago

还是不行吗

Jaylin0920 commented 4 years ago

还是不行吗

嗯嗯,如果楼主解决crash的主要思路,是改了那个Key值,那就是和我修改的方法是一样的,就是无法解决crash的问题

JiongXing commented 4 years ago

关联对象那里我换一种写法看看。今天会更新版本

JiongXing commented 4 years ago

老铁,更新3.1.1看下,搞了个新Bug不好意思,尴尬...

Jaylin0920 commented 4 years ago

感谢老铁更新,因为昨个crash量剧增达到5%,问题有些严重了,我昨个下午自己写了个图片浏览器😂 现在在使用自己的图片浏览器了

Jaylin0920 commented 4 years ago

十分感谢楼主近期的帮助🌹