DianQK / TransitionTreasury

Easier way to push your viewController.
https://transitiontreasury.com
MIT License
2.09k stars 157 forks source link

Scanbot vertical swipe on left-hand side is not recognizing gesture #19

Closed sinanku closed 8 years ago

sinanku commented 8 years ago

Just a heads up on a UI bug, the Scanbot vc is not recognizing swipe up or down gestures on the left-hand side while the middle and right-hand side work without issue. On an unrelated note, I've noticed a crash may potentially occur during a textfield becoming a first responder and while a view controller on scanbot is returning to the original vc, may want to take a look at that as well!

Update, the error being thrown is a nil value here

public func slideTransition(sender: UIPanGestureRecognizer) {

        let fromVC = transitionContext?.viewControllerForKey(UITransitionContextFromViewControllerKey)

        let view = fromVC!.view

on let view = fromVC!.view

DianQK commented 8 years ago

I have fix the Scanbot vc is not recognizing swipe up or down gestures on the left-hand side , I made a mistake on demo.

About this crash, do you call on .Began?

switch sender.state {
        case .Began:
                        /// some code
                        ...
            tr_presentViewController(vc, method: TRPresentTransitionMethod.Scanbot(present: sender, dismiss: vc.dismissGestureRecognizer), completion: {
                print("Present finished")
            })
            default: break
        }

If you have better idea~ free pr~ ^.^

sinanku commented 8 years ago

Awesome! And yes I call it on .Began

    func panDismiss(sender: UIPanGestureRecognizer) {
        switch sender.state {
        case .Began :
            guard sender.translationInView(view).y < 0 else {
                break
            }
            modalDelegate?.modalViewControllerDismiss(interactive: true, callbackData: ["option":"none"])
        default : break
        }
    }

It seems to occur on rare instances of a view controller initialization, if a touch occurs on a screen while a textfield/keypad is coming into focus but is hard to replicate so I cannot be entirely sure of its origination... wish I could give more details but this is all I have seen thus far.

sinanku commented 8 years ago

Forced it to throw a stacktrace, hope it helps. One way to recreate it is to swipe up and down close to the far left side quite a few times in alternating speeds. *note, it should be on the far-left of the first presented vc not the secondary vc

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) -> ():
    0x1022c65b0 <+0>:   stp    x29, x30, [sp, #-16]!
    0x1022c65b4 <+4>:   mov    x29, sp
    0x1022c65b8 <+8>:   sub    sp, sp, #16               ; =16 
    0x1022c65bc <+12>:  and    w8, w2, #0x1
    0x1022c65c0 <+16>:  tbnz   w8, #0, 0x1022c65e0       ; <+48>
    0x1022c65c4 <+20>:  tbnz   x1, #63, 0x1022c661c      ; <+108>
    0x1022c65c8 <+24>:  add    x1, x0, x1
    0x1022c65cc <+28>:  mov    x2, x3
    0x1022c65d0 <+32>:  mov    x3, x4
    0x1022c65d4 <+36>:  mov    x4, x5
    0x1022c65d8 <+40>:  bl     0x10230e604               ; function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded> of Swift.(_fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ()).(closure #2)
->  0x1022c65dc <+44>:  brk    #0x1
    0x1022c65e0 <+48>:  str    xzr, [sp, #8]
    0x1022c65e4 <+52>:  cmp    x0, w0, uxtw
    0x1022c65e8 <+56>:  b.ne   0x1022c6734               ; <+388>
    0x1022c65ec <+60>:  lsr    w8, w0, #11
    0x1022c65f0 <+64>:  cmp    w8, #26                   ; =26 
    0x1022c65f4 <+68>:  b.hi   0x1022c6640               ; <+144>
    0x1022c65f8 <+72>:  cmp    w0, #128                  ; =128 
    0x1022c65fc <+76>:  b.lo   0x1022c6684               ; <+212>
    0x1022c6600 <+80>:  cmp    w0, #2048                 ; =2048 
    0x1022c6604 <+84>:  b.hs   0x1022c66b4               ; <+260>
    0x1022c6608 <+88>:  movz   x8, #0
    0x1022c660c <+92>:  movz   x10, #0
    0x1022c6610 <+96>:  lsr    w9, w0, #6
    0x1022c6614 <+100>: orr    w9, w9, #0xffffffc0
    0x1022c6618 <+104>: b      0x1022c66e8               ; <+312>
    0x1022c661c <+108>: adr    x0, #723286               ; "fatal error"
    0x1022c6620 <+112>: nop    
    0x1022c6624 <+116>: adr    x3, #723788               ; "UnsafeBufferPointer with negative count"
    0x1022c6628 <+120>: nop    
    0x1022c662c <+124>: movz   w1, #0xb
    0x1022c6630 <+128>: orr    w2, wzr, #0x2
    0x1022c6634 <+132>: movz   w4, #0x27
    0x1022c6638 <+136>: orr    w5, wzr, #0x2
    0x1022c663c <+140>: bl     0x1022c65b0               ; <+0>
    0x1022c6640 <+144>: cmp    w0, #14, lsl #12          ; =57344 
    0x1022c6644 <+148>: b.lo   0x1022c6690               ; <+224>
    0x1022c6648 <+152>: cmp    w0, #272, lsl #12         ; =1114112 
    0x1022c664c <+156>: b.hs   0x1022c678c               ; <+476>
    0x1022c6650 <+160>: lsr    w8, w0, #6
    0x1022c6654 <+164>: lsr    w9, w0, #16
    0x1022c6658 <+168>: cbz    w9, 0x1022c66b8           ; <+264>
    0x1022c665c <+172>: lsr    w9, w0, #18
    0x1022c6660 <+176>: orr    w9, w9, #0xf0
    0x1022c6664 <+180>: cmp    w9, w9, uxtb
    0x1022c6668 <+184>: b.ne   0x1022c6734               ; <+388>
    0x1022c666c <+188>: orr    w10, wzr, #0xffffff80
    0x1022c6670 <+192>: bfxil  w10, w0, #12, #6
    0x1022c6674 <+196>: and    x12, x9, #0xff
    0x1022c6678 <+200>: str    x12, [sp, #8]
    0x1022c667c <+204>: orr    w11, wzr, #0x1
    0x1022c6680 <+208>: b      0x1022c66c8               ; <+280>
    0x1022c6684 <+212>: movz   x8, #0
    0x1022c6688 <+216>: movz   x9, #0
    0x1022c668c <+220>: b      0x1022c6724               ; <+372>
    0x1022c6690 <+224>: adr    x0, #723170               ; "fatal error"
    0x1022c6694 <+228>: nop    
    0x1022c6698 <+232>: adr    x3, #726600               ; "high- and low-surrogate code points are not valid Unicode scalar values"
    0x1022c669c <+236>: nop    
    0x1022c66a0 <+240>: movz   w1, #0xb
    0x1022c66a4 <+244>: orr    w2, wzr, #0x2
    0x1022c66a8 <+248>: movz   w4, #0x47
    0x1022c66ac <+252>: orr    w5, wzr, #0x2
    0x1022c66b0 <+256>: bl     0x1022c65b0               ; <+0>
    0x1022c66b4 <+260>: lsr    w8, w0, #6
    0x1022c66b8 <+264>: lsr    w9, w0, #12
    0x1022c66bc <+268>: movz   x11, #0
    0x1022c66c0 <+272>: movz   x12, #0
    0x1022c66c4 <+276>: orr    w10, w9, #0xffffffe0
    0x1022c66c8 <+280>: lsl    x13, x11, #3
    0x1022c66cc <+284>: orr    w9, wzr, #0xffffff80
    0x1022c66d0 <+288>: bfxil  w9, w8, #0, #6
    0x1022c66d4 <+292>: and    w8, w10, #0xff
    0x1022c66d8 <+296>: lsl    x8, x8, x13
    0x1022c66dc <+300>: orr    x10, x8, x12
    0x1022c66e0 <+304>: str    x10, [sp, #8]
    0x1022c66e4 <+308>: add    x8, x11, #1               ; =1 
    0x1022c66e8 <+312>: orr    w11, wzr, #0x8
    0x1022c66ec <+316>: umulh  x11, x8, x11
    0x1022c66f0 <+320>: cmp    xzr, x11
    0x1022c66f4 <+324>: b.ne   0x1022c6734               ; <+388>
    0x1022c66f8 <+328>: lsl    x11, x8, #3
    0x1022c66fc <+332>: cmp    x11, #63                  ; =63 
    0x1022c6700 <+336>: b.hi   0x1022c6768               ; <+440>
    0x1022c6704 <+340>: orr    w12, wzr, #0x80
    0x1022c6708 <+344>: bfxil  x12, x0, #0, #6
    0x1022c670c <+348>: and    w9, w9, #0xff
    0x1022c6710 <+352>: lsl    x9, x9, x11
    0x1022c6714 <+356>: orr    x9, x9, x10
    0x1022c6718 <+360>: str    x9, [sp, #8]
    0x1022c671c <+364>: add    x8, x8, #1                ; =1 
    0x1022c6720 <+368>: mov    x0, x12
    0x1022c6724 <+372>: orr    w10, wzr, #0x8
    0x1022c6728 <+376>: umulh  x10, x8, x10
    0x1022c672c <+380>: cmp    xzr, x10
    0x1022c6730 <+384>: b.eq   0x1022c6738               ; <+392>
    0x1022c6734 <+388>: brk    #0x1
    0x1022c6738 <+392>: lsl    x10, x8, #3
    0x1022c673c <+396>: cmp    x10, #64                  ; =64 
    0x1022c6740 <+400>: b.hs   0x1022c6768               ; <+440>
    0x1022c6744 <+404>: and    x11, x0, #0xff
    0x1022c6748 <+408>: lsl    x10, x11, x10
    0x1022c674c <+412>: orr    x9, x10, x9
    0x1022c6750 <+416>: str    x9, [sp, #8]
    0x1022c6754 <+420>: add    x9, sp, #8                ; =8 
    0x1022c6758 <+424>: add    x8, x8, x9
    0x1022c675c <+428>: add    x1, x8, #1                ; =1 
    0x1022c6760 <+432>: add    x0, sp, #8                ; =8 
    0x1022c6764 <+436>: b      0x1022c65cc               ; <+28>
    0x1022c6768 <+440>: adr    x0, #722954               ; "fatal error"
    0x1022c676c <+444>: nop    
    0x1022c6770 <+448>: adr    x3, #723360               ; "shift amount is larger than type size in bits"
    0x1022c6774 <+452>: nop    
    0x1022c6778 <+456>: movz   w1, #0xb
    0x1022c677c <+460>: orr    w2, wzr, #0x2
    0x1022c6780 <+464>: movz   w4, #0x2d
    0x1022c6784 <+468>: orr    w5, wzr, #0x2
    0x1022c6788 <+472>: bl     0x1022c65b0               ; <+0>
    0x1022c678c <+476>: adr    x0, #722918               ; "fatal error"
    0x1022c6790 <+480>: nop    
    0x1022c6794 <+484>: adr    x3, #726428               ; "value is outside of Unicode codespace"
    0x1022c6798 <+488>: nop    
    0x1022c679c <+492>: movz   w1, #0xb
    0x1022c67a0 <+496>: orr    w2, wzr, #0x2
    0x1022c67a4 <+500>: movz   w4, #0x25
    0x1022c67a8 <+504>: orr    w5, wzr, #0x2
    0x1022c67ac <+508>: bl     0x1022c65b0               ; <+0>

Additional trace


UIKit`UIApplicationMain:
    0x1032b0e5e <+0>:   pushq  %rbp
    0x1032b0e5f <+1>:   movq   %rsp, %rbp
    0x1032b0e62 <+4>:   pushq  %r15
    0x1032b0e64 <+6>:   pushq  %r14
    0x1032b0e66 <+8>:   pushq  %r13
    0x1032b0e68 <+10>:  pushq  %r12
    0x1032b0e6a <+12>:  pushq  %rbx
    0x1032b0e6b <+13>:  pushq  %rax
    0x1032b0e6c <+14>:  movq   %rcx, %rbx
    0x1032b0e6f <+17>:  movq   %rsi, %r15
    0x1032b0e72 <+20>:  movl   %edi, %r12d
    0x1032b0e75 <+23>:  movq   0xd69374(%rip), %r13      ; (void *)0x0000000106cc8d00: objc_retain
    0x1032b0e7c <+30>:  movq   %rdx, %rdi
    0x1032b0e7f <+33>:  callq  *%r13
    0x1032b0e82 <+36>:  movq   %rax, %r14
    0x1032b0e85 <+39>:  movq   %rbx, %rdi
    0x1032b0e88 <+42>:  callq  *%r13
    0x1032b0e8b <+45>:  movq   %rax, %r13
    0x1032b0e8e <+48>:  leaq   0xd6775f(%rip), %rbx      ; _UIApplicationLinkedOnVersion
    0x1032b0e95 <+55>:  movl   (%rbx), %eax
    0x1032b0e97 <+57>:  testl  %eax, %eax
    0x1032b0e99 <+59>:  jne    0x1032b0eba               ; <+92>
    0x1032b0e9b <+61>:  cmpq   $-0x1, 0xd62bdd(%rip)     ; WebKitSetIsClassic + 7
    0x1032b0ea3 <+69>:  je     0x1032b0ee4               ; <+134>
    0x1032b0ea5 <+71>:  leaq   0xd62bd4(%rip), %rdi      ; _UIApplicationLinkedOnVersionOnce
    0x1032b0eac <+78>:  leaq   0xd6c76d(%rip), %rsi      ; __block_literal_global1474
    0x1032b0eb3 <+85>:  callq  0x103d832b8               ; symbol stub for: dispatch_once
    0x1032b0eb8 <+90>:  movl   (%rbx), %eax
    0x1032b0eba <+92>:  cmpl   $0x20100, %eax            ; imm = 0x20100 
    0x1032b0ebf <+97>:  jb     0x1032b0ee4               ; <+134>
    0x1032b0ec1 <+99>:  callq  0x103d82a66               ; symbol stub for: objc_autoreleasePoolPush
    0x1032b0ec6 <+104>: movq   %rax, %rbx
    0x1032b0ec9 <+107>: movl   %r12d, %edi
    0x1032b0ecc <+110>: movq   %r15, %rsi
    0x1032b0ecf <+113>: movq   %r14, %rdx
    0x1032b0ed2 <+116>: movq   %r13, %rcx
    0x1032b0ed5 <+119>: callq  0x1032b0f2b               ; _UIApplicationMainPreparations
    0x1032b0eda <+124>: movq   %rbx, %rdi
    0x1032b0edd <+127>: callq  0x103d82a60               ; symbol stub for: objc_autoreleasePoolPop
    0x1032b0ee2 <+132>: jmp    0x1032b0ef5               ; <+151>
    0x1032b0ee4 <+134>: movl   %r12d, %edi
    0x1032b0ee7 <+137>: movq   %r15, %rsi
    0x1032b0eea <+140>: movq   %r14, %rdx
    0x1032b0eed <+143>: movq   %r13, %rcx
    0x1032b0ef0 <+146>: callq  0x1032b0f2b               ; _UIApplicationMainPreparations
    0x1032b0ef5 <+151>: movq   0xd6764c(%rip), %rdi      ; UIApp
    0x1032b0efc <+158>: movq   0xce6ba5(%rip), %rsi      ; "_run"
    0x1032b0f03 <+165>: callq  *0xd692d7(%rip)           ; (void *)0x0000000106ccb800: objc_msgSend
    0x1032b0f09 <+171>: movq   0xd692d8(%rip), %rbx      ; (void *)0x0000000106cc8d70: objc_release
    0x1032b0f10 <+178>: movq   %r13, %rdi
    0x1032b0f13 <+181>: callq  *%rbx
    0x1032b0f15 <+183>: movq   %r14, %rdi
    0x1032b0f18 <+186>: callq  *%rbx
    0x1032b0f1a <+188>: xorl   %eax, %eax
    0x1032b0f1c <+190>: addq   $0x8, %rsp
    0x1032b0f20 <+194>: popq   %rbx
    0x1032b0f21 <+195>: popq   %r12
    0x1032b0f23 <+197>: popq   %r13
    0x1032b0f25 <+199>: popq   %r14
    0x1032b0f27 <+201>: popq   %r15
    0x1032b0f29 <+203>: popq   %rbp
    0x1032b0f2a <+204>: retq   
sinanku commented 8 years ago

@DianQK

Edit: Sent you a PR! https://github.com/DianQK/TransitionTreasury/pull/20