JiongXing / PhotoBrowser

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

@objc JXPhotoBrowserFadeAnimator.animateTransition(using:) 崩溃 #173

Closed Jaylin0920 closed 4 years ago

Jaylin0920 commented 4 years ago

您好,碰到一个崩溃,日志定位在JXPhotoBrowserFadeAnimator.animateTransition(using:)处,能帮忙看看么

以下是崩溃日志

已崩溃:com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000020

0
libobjc.A.dylib
objc_retain + 16
1
Olaa
<compiler-generated> - 第 4300510080 行
@objc JXPhotoBrowserFadeAnimator.animateTransition(using:) + 4300510080
2
UIKitCore
___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 60
24
UIKitCore
UIApplicationMain + 1940
25
MMAppDelegate.swift - 第 12 行
main + 12
26
libdyld.dylib
start + 4
Jaylin0920 commented 4 years ago

源码是

public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        guard let browser = photoBrowser else {
            transitionContext.completeTransition(false)
            return
        }
        if isForShow {
            browser.maskView.alpha = 0
            browser.browserView.alpha = 0
            if let toView = transitionContext.view(forKey: .to) {
                transitionContext.containerView.addSubview(toView)
            }
        } else {
            if isNavigationAnimation,
                let fromView = transitionContext.view(forKey: .from),
                let toView = transitionContext.view(forKey: .to) {
                transitionContext.containerView.insertSubview(toView, belowSubview: fromView)
            }
        }
        UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: {
            browser.maskView.alpha = self.isForShow ? 1.0 : 0
            browser.browserView.alpha = self.isForShow ? 1.0 : 0
        }) { _ in
            transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
        }
    }
Jaylin0920 commented 4 years ago

因为是偶发,没办法定位,想问下您这边有什么想法和建议?

JiongXing commented 4 years ago

用的是哪个版本的库?

JiongXing commented 4 years ago

如果不知道的话,用文本编辑器打开podfile.lock搜JXPhotoBrowser搜搜看。我好找对应版本代码看

JiongXing commented 4 years ago

大概是个怎样操作下的崩溃?能知道不?

Jaylin0920 commented 4 years ago

没有使用pod,是拿的源码,2天前刚用的,是Download下来最新的代码

Jaylin0920 commented 4 years ago

在第一次打开图片浏览器的时候,产生的崩溃。崩溃日志就是我上面发的那些,可以看到的东西很少,所以我这边也没什么想法

JiongXing commented 4 years ago

你是如何使用这个库的,代码可以发下我看看吗?

Jaylin0920 commented 4 years ago

代码业务比较多,不太好拆开,我看了下,很难复现这个Bug,最后当做是系统bug暂不处理了

Jaylin0920 commented 4 years ago

还是很感谢楼主百忙中的回复,感谢🌹

JiongXing commented 4 years ago

感谢反馈,如果我找到原因修复了就通知你

Jaylin0920 commented 4 years ago

🌹