有人遇到同样困扰的问题吗?我无法弄清楚UIView会向他发送发布消息。
非常感谢您的任何建议。
我的测试代码严格遵循Apple tableView / Search示例代码指南。初始TableView工作完美。触发过滤后的tableView以显示在UISearchController中 - > searchResultsController,代码如下。
func updateSearchResultsForSearchController(searchController: UISearchController) {
...
let tableController = self.searchController!.searchResultsController as! FilteredTableViewController
tableController.datasource = self.tableData?.tableFilteredCellRecords
tableController.navController = self.navigationController
tableController.tableView.reloadData()
...
}
在过滤后的tableView中,单元格行显示OK,然后单击任意单元格以触发细节UIView显示,代码如下:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let record = self.tableData!.getFilteredTableRecord(indexPath.row)
if(record != nil) {
let detailViewController = DetailViewController()
detailViewController.titleText = record?.title
detailViewController.descText = record?.desc
detailViewController.imgExist = record!.imgview
self.navigationController?.pushViewController(detailViewController, animated: false)
}
}
然后细节UIView显示效果很好,但点击“返回”后按钮返回TableView,App崩溃。
启用Zombie后,调试报告:
(lldb)
Optional("A server with the specified hostname could not be found.")
2015-05-04 22:45:31.687 Swift_UI_programmatically[2057:419330] *** -[UIViewControllerWrapperView release]: message sent to deallocated instance 0x7fdefe0d8250
(lldb)
0x102db5f49 <+489>: callq *0x3062a1(%rip) ; (void *)0x0000000102b08000: objc_msgSend
0x102db5f4f <+495>: jmp 0x102db5f72 ; <+530>
0x102db5f51 <+497>: movq %r14, %rdi
0x102db5f54 <+500>: callq 0x102eaff58 ; symbol stub for: object_getClassName
0x102db5f59 <+505>: movq %rax, %rcx
0x102db5f5c <+508>: leaq 0x32cabd(%rip), %rsi ; @"*** NSForwarding: warning: object %p of class '%s' does not implement forwardInvocation: -- dropping message"
0x102db5f63 <+515>: movl $0x4, %edi
0x102db5f68 <+520>: xorl %eax, %eax
0x102db5f6a <+522>: movq %r14, %rdx
0x102db5f6d <+525>: callq 0x102dfd000 ; CFLog
0x102db5f72 <+530>: movq 0x34b0a7(%rip), %rax ; NSInvocation._retainedArgs
0x102db5f79 <+537>: cmpb $0x0, (%rbx,%rax)
0x102db5f7d <+541>: je 0x102db5fb1 ; <+593>
0x102db5f7f <+543>: movq (%r13), %rax
0x102db5f83 <+547>: testb $-0x80, 0x22(%rax)
0x102db5f87 <+551>: je 0x102db5fb1 ; <+593>
0x102db5f89 <+553>: movq 0x34b080(%rip), %rcx ; NSInvocation._frame
0x102db5f90 <+560>: movq (%rbx,%rcx), %rcx
0x102db5f94 <+564>: movl 0x1c(%rax), %edx
0x102db5f97 <+567>: movzbl 0x20(%rax), %esi
0x102db5f9b <+571>: addq %rdx, %rsi
0x102db5f9e <+574>: movq (%r15,%rsi), %rdi
0x102db5fa2 <+578>: movq (%rcx,%rsi), %rsi
0x102db5fa6 <+582>: movq (%rax), %rax
0x102db5fa9 <+585>: movl 0x10(%rax), %edx
0x102db5fac <+588>: callq 0x102eb04b0 ; symbol stub for: memmove
0x102db5fb1 <+593>: movq 0x34b050(%rip), %rax ; NSInvocation._retdata
0x102db5fb8 <+600>: movq (%rbx,%rax), %r15
0x102db5fbc <+604>: movq 0x34a02d(%rip), %rsi ; "methodReturnType"
0x102db5fc3 <+611>: movq %r12, %rdi
0x102db5fc6 <+614>: callq *0x306224(%rip) ; (void *)0x0000000102b08000: objc_msgSend
0x102db5fcc <+620>: movzbl (%rax), %eax
0x102db5fcf <+623>: cmpl $0x44, %eax
0x102db5fd2 <+626>: jne 0x102db6009 ; <+681>
0x102db5fd4 <+628>: fldt (%r15)
0x102db5fd7 <+631>: jmp 0x102db6009 ; <+681>
0x102db5fd9 <+633>: movq %rax, %rbx
0x102db5fdc <+636>: movq %rbx, %rdi
0x102db5fdf <+639>: callq 0x102e60560 ; getAtomTarget
0x102db5fe4 <+644>: movq %rax, %r12
0x102db5fe7 <+647>: movq %r12, (%r15,%r14)
0x102db5feb <+651>: movl $0x400, %ecx
0x102db5ff0 <+656>: xorl %r8d, %r8d
0x102db5ff3 <+659>: movq %r13, %rdi
0x102db5ff6 <+662>: movq %r15, %rsi
0x102db5ff9 <+665>: movq %r15, %rdx
0x102db5ffc <+668>: callq 0x102d4ed60 ; __invoking___
0x102db6001 <+673>: cmpq %r12, (%r15)
0x102db6004 <+676>: jne 0x102db6009 ; <+681>
0x102db6006 <+678>: movq %rbx, (%r15)
0x102db6009 <+681>: movq %r15, %rax
0x102db600c <+684>: addq $0x18, %rsp
0x102db6010 <+688>: popq %rbx
0x102db6011 <+689>: popq %r12
0x102db6013 <+691>: popq %r13
0x102db6015 <+693>: popq %r14
0x102db6017 <+695>: popq %r15
0x102db6019 <+697>: popq %rbp
0x102db601a <+698>: retq
0x102db601b <+699>: leaq 0x35638e(%rip), %rax ; __CFOASafe
0x102db6022 <+706>: cmpb $0x0, (%rax)
0x102db6025 <+709>: je 0x102db603b ; <+731>
0x102db6027 <+711>: movl $0x15, %edi
0x102db602c <+716>: xorl %edx, %edx
0x102db602e <+718>: xorl %ecx, %ecx
0x102db6030 <+720>: xorl %r8d, %r8d
0x102db6033 <+723>: movq %r13, %rsi
0x102db6036 <+726>: callq 0x102e30880 ; __CFRecordAllocationEvent
0x102db603b <+731>: addq $0xa, %rbx
0x102db603f <+735>: movq -0x30(%rbp), %rdi
0x102db6043 <+739>: callq 0x102eaff76 ; symbol stub for: sel_getName
0x102db6048 <+744>: movq %rax, %rcx
0x102db604b <+747>: leaq 0x32c90e(%rip), %rdx ; @"*** -[%s %s]: message sent to deallocated instance %p"
0x102db6052 <+754>: movl $0x3, %edi
0x102db6057 <+759>: xorl %eax, %eax
0x102db6059 <+761>: movq %rdx, %rsi
0x102db605c <+764>: movq %rbx, %rdx
0x102db605f <+767>: movq %r13, %r8
0x102db6062 <+770>: callq 0x102dfd000 ; CFLog
0x102db6067 <+775>: int3
-> 0x102db6068 <+776>: jmp 0x102db6167 ; <+1031>
0x102db606d <+781>: movq %r12, %rdi
答案 0 :(得分:1)
试试这个
self.view = [[UIView alloc]initWithFrame:self.view.frame];
更改viewController ..
答案 1 :(得分:0)
在stackoverflow中阅读了很多讨论后,最后得到一个有用的建议,这真的有效。 '不要同时推动两个viewControllers动画。在没有动画的情况下推送第一个,然后用动画推动第二个动画。 UINavigationController无法同时处理两个动画'
UINavigationController crash because of pushing and poping UIViewControllers
最后,只更改一行代码:self.navigationController?.pushViewController(),将动画设置为true。这个bug是修复的。我无法相信这是iOS错误或一些未知的知识。