关闭模态 UIViewController 时出现 EXC_BAD_ACCESS 错误
这是我在这里发表的第一篇文章。
我是 iPhone SDK 的新手。请回答我的问题,即使很简单。 我创建了一个基于导航的应用程序。层次结构如下:
NavigationController - RootViewController - ATableViewController(推过 RootViewController)
首先在 RootViewController 上我推了 ATableViewController。然后,我将展示一个带有 TabBarController 的视图控制器(它有四个选项卡,每个选项卡都有自己的导航控制器)。
现在我想在每个导航控制器上保留两个按钮。单击其中一个时,它应该关闭模态视图控制器,单击另一个时,它应该返回到 RootViewController。
因此,我在 UINavigationBar 上保留了按钮来关闭模式视图控制器。然而,在关闭它时,我收到一个错误:
*** -[CALayer superlayer]:消息发送到已释放的实例0xb157840
回溯是:
#0 0x011bb657 in ___forwarding___ ()
#1 0x011bb522 in __forwarding_prep_0___ ()
#2 0x004c54e5 in _UIConvertDisplayPointToWindow ()
#3 0x004c5695 in +[UIWindow _hitTestToPoint:pathIndex:forEvent:] ()
#4 0x004a5709 in _UIApplicationHandleEvent ()
#5 0x01cf8992 in PurpleEventCallback ()
#6 0x0122b944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#7 0x0118bcf7 in __CFRunLoopDoSource1 ()
#8 0x01188f83 in __CFRunLoopRun ()
#9 0x01188840 in CFRunLoopRunSpecific ()
#10 0x01188761 in CFRunLoopRunInMode ()
#11 0x01cf71c4 in GSEventRunModal ()
#12 0x01cf7289 in GSEventRun ()
#13 0x004aac93 in UIApplicationMain ()
#14 0x00001cd9 in main (argc=1, argv=0xbffff678) at main.m:14
任何人请帮助我。我在这个问题上挣扎了两周。我花了很多时间谷歌搜索它。
非常感谢任何帮助。
感谢您的阅读。
This is my first post here.
I'm a newbie to the iPhone SDK. Please answer my question even if it is simple.
I've created a navigation based application. The hierarchy as follows:
NavigationController - RootViewController
- ATableViewController (pushed over RootViewController)
On RootViewController first I've pushed ATableViewController. Then, I'm presenting a view controller with TabBarController (which has four tabs each having its own navigation controller).
Now I want to keep two buttons on each navigation controller. On clicking one it should dismiss the modal view controller and on clicking the other it should return to RootViewController.
So, I've kept button on the UINavigationBar
to dismiss the modal view controller. However on dismissing it I'm receiving an error:
*** -[CALayer superlayer]: message sent to deallocated instance 0xb157840
the backtrace is:
#0 0x011bb657 in ___forwarding___ ()
#1 0x011bb522 in __forwarding_prep_0___ ()
#2 0x004c54e5 in _UIConvertDisplayPointToWindow ()
#3 0x004c5695 in +[UIWindow _hitTestToPoint:pathIndex:forEvent:] ()
#4 0x004a5709 in _UIApplicationHandleEvent ()
#5 0x01cf8992 in PurpleEventCallback ()
#6 0x0122b944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#7 0x0118bcf7 in __CFRunLoopDoSource1 ()
#8 0x01188f83 in __CFRunLoopRun ()
#9 0x01188840 in CFRunLoopRunSpecific ()
#10 0x01188761 in CFRunLoopRunInMode ()
#11 0x01cf71c4 in GSEventRunModal ()
#12 0x01cf7289 in GSEventRun ()
#13 0x004aac93 in UIApplicationMain ()
#14 0x00001cd9 in main (argc=1, argv=0xbffff678) at main.m:14
Anyone please please help me out. I'm struggling with this problem from two weeks. I've spent many hours googling it.
Any help is greatly appreciated.
Thanks for reading.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看这篇文章如何设置
NSZombieEnabled
。这将显示有关崩溃的更多详细信息,以帮助您调试问题:应用程序仅在 iPhone 设备上崩溃,而不在模拟器中崩溃
Check on this post how to set
NSZombieEnabled
. That will show more details on crashes that should help you debug your issue :App crash only on iPhone Device and not in Simulator