gpt4 book ai didi

ios - 当 popoverPresentationController 和键盘关闭时应用程序崩溃

转载 作者:行者123 更新时间:2023-12-02 00:43:07 26 4
gpt4 key购买 nike

我有一个UIViewController,它添加了一个UITableView、一个UISearchController。我将此 ViewController 呈现为 UIModalPresentationPopover 样式。如果我只关闭 ViewController,那没问题。但是当搜索文本和键盘显示时,则关闭ViewController,它崩溃了!当我点击弹出窗口 View 之外的区域时,它不会崩溃。

[Self dismissViewControllerAnimated:YES completion:nil];//dismiss 

当关闭时它会崩溃,如下图所示。 enter image description here enter image description here

  Thread 1 > 19 UIApplicationMain
UIKit`UIApplicationMain:
0x11119d549 <+0>: pushq %rbp
0x11119d54a <+1>: movq %rsp, %rbp
0x11119d54d <+4>: pushq %r15
0x11119d54f <+6>: pushq %r14
0x11119d551 <+8>: pushq %r13
0x11119d553 <+10>: pushq %r12
0x11119d555 <+12>: pushq %rbx
0x11119d556 <+13>: pushq %rax
0x11119d557 <+14>: movq %rcx, %rbx
0x11119d55a <+17>: movq %rsi, -0x30(%rbp)
0x11119d55e <+21>: movl %edi, %r12d
0x11119d561 <+24>: movq 0x115d090(%rip), %r13 ; (void *)0x0000000114a1dc50: objc_retain
0x11119d568 <+31>: movq %rdx, %rdi
0x11119d56b <+34>: callq *%r13
0x11119d56e <+37>: movq %rax, %r14
0x11119d571 <+40>: movq %rbx, %rdi
0x11119d574 <+43>: callq *%r13
0x11119d577 <+46>: movq %rax, %r15
0x11119d57a <+49>: leaq 0x158700b(%rip), %r13 ; _UIApplicationLinkedOnVersion
0x11119d581 <+56>: movl (%r13), %eax
0x11119d585 <+60>: testl %eax, %eax
0x11119d587 <+62>: jne 0x11119d597 ; <+78>
0x11119d589 <+64>: cmpq $-0x1, 0x157fc7f(%rip) ; WebKitSetIsClassic + 7
0x11119d591 <+72>: jne 0x11119d60a ; <+193>
0x11119d593 <+74>: movl (%r13), %eax
0x11119d597 <+78>: cmpl $0x20100, %eax ; imm = 0x20100
0x11119d59c <+83>: jb 0x11119d5c2 ; <+121>
0x11119d59e <+85>: callq 0x11200f0a8 ; symbol stub for: objc_autoreleasePoolPush
0x11119d5a3 <+90>: movq %rax, %r13
0x11119d5a6 <+93>: movl %r12d, %edi
0x11119d5a9 <+96>: movq -0x30(%rbp), %rsi
0x11119d5ad <+100>: movq %r14, %rdx
0x11119d5b0 <+103>: movq %r15, %rcx
0x11119d5b3 <+106>: callq 0x11119d622 ; _UIApplicationMainPreparations
0x11119d5b8 <+111>: movq %r13, %rdi
0x11119d5bb <+114>: callq 0x11200f0a2 ; symbol stub for: objc_autoreleasePoolPop
0x11119d5c0 <+119>: jmp 0x11119d5d4 ; <+139>
0x11119d5c2 <+121>: movl %r12d, %edi
0x11119d5c5 <+124>: movq -0x30(%rbp), %rsi
0x11119d5c9 <+128>: movq %r14, %rdx
0x11119d5cc <+131>: movq %r15, %rcx
0x11119d5cf <+134>: callq 0x11119d622 ; _UIApplicationMainPreparations
0x11119d5d4 <+139>: movq 0x1586ef5(%rip), %rdi ; UIApp
0x11119d5db <+146>: movq 0x14d2b06(%rip), %rsi ; "_run"
0x11119d5e2 <+153>: callq *0x115d000(%rip) ; (void *)0x0000000114a20940: objc_msgSend
0x11119d5e8 <+159>: movq 0x115d001(%rip), %rbx ; (void *)0x0000000114a1dcc0: objc_release
0x11119d5ef <+166>: movq %r15, %rdi
0x11119d5f2 <+169>: callq *%rbx
0x11119d5f4 <+171>: movq %r14, %rdi
0x11119d5f7 <+174>: callq *%rbx
0x11119d5f9 <+176>: xorl %eax, %eax
0x11119d5fb <+178>: addq $0x8, %rsp
0x11119d5ff <+182>: popq %rbx
0x11119d600 <+183>: popq %r12
0x11119d602 <+185>: popq %r13
0x11119d604 <+187>: popq %r14
0x11119d606 <+189>: popq %r15
0x11119d608 <+191>: popq %rbp
0x11119d609 <+192>: retq
0x11119d60a <+193>: leaq 0x157fbff(%rip), %rdi ; _UIApplicationLinkedOnVersionOnce
0x11119d611 <+200>: leaq 0x1160910(%rip), %rsi ; __block_literal_global.1491
0x11119d618 <+207>: callq 0x11200edf6 ; symbol stub for: dispatch_once
0x11119d61d <+212>: jmp 0x11119d593 ; <+74>

最佳答案

首先,取消searchController

[self searchBarCancelButtonClicked:yourSearchBar];

[self.searchDisplayController setActive:NO animated:YES];

然后关闭 View Controller 。

[self dismissViewControllerAnimated:YES completion:nil];

这会有帮助。

关于ios - 当 popoverPresentationController 和键盘关闭时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47389886/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com