Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwitterPagerTabStripViewController crash on back navigation #178

Closed
vzsg opened this issue Jun 4, 2016 · 2 comments
Closed

TwitterPagerTabStripViewController crash on back navigation #178

vzsg opened this issue Jun 4, 2016 · 2 comments
Assignees

Comments

@vzsg
Copy link

vzsg commented Jun 4, 2016

When using TwitterPagerTabStripViewController as a pushed view controller, navigating backwards results in a crash: fatal error: unexpectedly found nil while unwrapping an Optional value in line 232.

The property navigationController is nil during the transition, so trying to force unwrapping explodes.

Stack trace

* thread #1: tid = 0x45c110, 0x043a4393 libswiftCore.dylib`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ()   67, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x043a4393 libswiftCore.dylib`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ()   67
  * frame #1: 0x02875719 XLPagerTabStrip`TwitterPagerTabStripViewController.(self=0x7a192400).getter   201 at TwitterPagerTabStripViewController.swift:232
    frame #2: 0x0287469d XLPagerTabStrip`TwitterPagerTabStripViewController.(updateAlpha=false, self=0x7a192400)(updateAlpha : Bool) -> ()   61 at TwitterPagerTabStripViewController.swift:193
    frame #3: 0x02873d0b XLPagerTabStrip`TwitterPagerTabStripViewController.viewDidLayoutSubviews(self=0x7a192400) -> ()   75 at TwitterPagerTabStripViewController.swift:131
    frame #4: 0x02873d32 XLPagerTabStrip`@objc TwitterPagerTabStripViewController.viewDidLayoutSubviews() -> ()   34 at TwitterPagerTabStripViewController.swift:0
    frame #5: 0x013e3427 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:]   893
    frame #6: 0x02d65059 libobjc.A.dylib`-[NSObject performSelector:withObject:]   70
    frame #7: 0x040f4096 QuartzCore`-[CALayer layoutSublayers]   144
    frame #8: 0x040e78b6 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*)   388
    frame #9: 0x040e771a QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*)   26
    frame #10: 0x040d9ee7 QuartzCore`CA::Context::commit_transaction(CA::Transaction*)   317
    frame #11: 0x0410e847 QuartzCore`CA::Transaction::commit()   561
    frame #12: 0x041100b8 QuartzCore`CA::Transaction::flush_transaction()   50
    frame #13: 0x0130c9b1 UIKit`_UIApplicationHandleEventQueue   8379
    frame #14: 0x0349ae5f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__   15
    frame #15: 0x03490aeb CoreFoundation`__CFRunLoopDoSources0   523
    frame #16: 0x0348ff08 CoreFoundation`__CFRunLoopRun   1032
    frame #17: 0x0348f846 CoreFoundation`CFRunLoopRunSpecific   470
    frame #18: 0x0348f65b CoreFoundation`CFRunLoopRunInMode   123
    frame #19: 0x0718b664 GraphicsServices`GSEventRunModal   192
    frame #20: 0x0718b4a1 GraphicsServices`GSEventRun   104
    frame #21: 0x01312eb9 UIKit`UIApplicationMain   160
    frame #22: 0x00382271 APP_REDACTED`main   145 at AppDelegate.swift:16
    frame #23: 0x048a1a25 libdyld.dylib`start   1

Environment

XLPagerTabStrip version: 5.0.0 (latest from Cocoapods)
Xcode version: 7.3 (7D175)
iOS version: 9.3 (Simulator)

Workaround

In my TPTSVC subclass, I'm overriding viewDidLayourSubviews to avoid the crash as such:

    override func viewDidLayoutSubviews() {
        guard let _ = navigationController else {
            return
        }

        super.viewDidLayoutSubviews()
    }
@vzsg
Copy link
Author

vzsg commented Jun 4, 2016

It might be a clash between another pod (AMScrollingNavbar in my project), but force unwrapping is never safe either way.

@mtnbarreto
Copy link
Member

@vzsg thanks for reporting the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants