View Controller在发布后将消息发送给它,导致崩溃 [英] View Controller getting a message sent to it after release, causes a crash

查看:87
本文介绍了View Controller在发布后将消息发送给它,导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设置,其中(以模态方式)呈现一个UIPickerViewController,然后将更多的控制器压入堆栈进行图像编辑.如果我按下后退"按钮并进入根视图控制器,然后按下另一个选项卡,则应用程序将崩溃.

I have a setup where I am presenting a UIPickerViewController (modally) and then some more controllers get pushed on the stack for image editing. If I hit the back button and get to the root view controller , then hit another tab, the app crashes.

这是崩溃消息:

-[PostPhotoViewController respondsToSelector:]: message sent to deallocated instance 0x19b16a60

我运行了Zombies工具,看起来好像堆栈上的最后一个View Controller(PostPhotoViewController)正在将消息发送给它,即使它已经发布了.这在iOS5和iOS 6上都在发生,因此我没有进行任何手动释放/保留.

I ran Zombies instruments and it looks like the last View Controller (PostPhotoViewController) that was on the stack is getting messages sent to it, even though it has been released. This is happening both on iOS5 and 6, so I am not doing any manual releasing/retaining.

我已将所有出口设置为零,而不再订阅所有通知.该消息似乎来自选项卡栏控制器.

I have set all the outlets to nil PostPhotoVC and unsubscribing from all notifications. The message seems to be coming from the tab bar controller.

不确定如何阻止它吗,有什么想法吗?

Not sure how to stop it, any ideas?

这是僵尸的读数:

#   Address Category    Event Type  RefCt   Timestamp   Size    Responsible Library Responsible Caller
0   0x1b730790  PostPhotoViewController Malloc  1   00:19.248.903   256 UIKit   -[UIClassSwapper initWithCoder:]
1   0x1b730790  PostPhotoViewController Retain  2   00:19.248.948   0   UIKit   UINibDecoderDecodeObjectForValue
2   0x1b730790  PostPhotoViewController Retain  3   00:19.248.998   0   UIKit   -[UIRuntimeConnection initWithCoder:]
3   0x1b730790  PostPhotoViewController Retain  4   00:19.249.004   0   UIKit   -[UIRuntimeConnection initWithCoder:]
4   0x1b730790  PostPhotoViewController Retain  5   00:19.249.025   0   UIKit   -[UIRuntimeConnection initWithCoder:]
5   0x1b730790  PostPhotoViewController Retain  6   00:19.249.030   0   UIKit   -[UIRuntimeConnection initWithCoder:]
6   0x1b730790  PostPhotoViewController Retain  7   00:19.249.067   0   UIKit   UINibDecoderDecodeObjectForValue
7   0x1b730790  PostPhotoViewController Retain  8   00:19.249.080   0   UIKit   UINibDecoderDecodeObjectForValue
8   0x1b730790  PostPhotoViewController Retain  9   00:19.249.648   0   UIKit   -[UIStoryboardScene setSceneViewController:]
9   0x1b730790  PostPhotoViewController Retain  10  00:19.249.759   0   UIKit   -[UINib instantiateWithOwner:options:]
10  0x1b730790  PostPhotoViewController Release 9   00:19.249.849   0   UIKit   -[UINibDecoder finishDecoding]
11  0x1b730790  PostPhotoViewController Release 8   00:19.249.884   0   UIKit   -[UINibDecoder finishDecoding]
12  0x1b730790  PostPhotoViewController Release 7   00:19.249.897   0   UIKit   -[UINibDecoder finishDecoding]
13  0x1b730790  PostPhotoViewController Release 6   00:19.249.900   0   UIKit   -[UINibDecoder finishDecoding]
14  0x1b730790  PostPhotoViewController Release 5   00:19.249.921   0   UIKit   -[UIRuntimeConnection dealloc]
15  0x1b730790  PostPhotoViewController Release 4   00:19.249.930   0   UIKit   -[UIRuntimeConnection dealloc]
16  0x1b730790  PostPhotoViewController Release 3   00:19.249.936   0   UIKit   -[UIRuntimeConnection dealloc]
17  0x1b730790  PostPhotoViewController Release 2   00:19.249.946   0   UIKit   -[UIRuntimeConnection dealloc]
18  0x1b730790  PostPhotoViewController Retain  3   00:19.249.998   0   UIKit   -[UIStoryboardSegue initWithIdentifier:source:destination:]
19  0x1b730790  PostPhotoViewController Retain  4   00:19.250.010   0   V Nation    -[ImageEditViewController prepareForSegue:sender:]
20  0x1b730790  PostPhotoViewController Release 3   00:19.250.018   0   V Nation    -[ImageEditViewController prepareForSegue:sender:]
21  0x1b730790  PostPhotoViewController Retain  4   00:19.250.045   0   UIKit   -[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:]
22  0x1b730790  PostPhotoViewController Release 3   00:19.254.033   0   UIKit   -[UIStoryboardSegue dealloc]
23  0x1b730790  PostPhotoViewController Release 2   00:19.254.037   0   UIKit   _UIApplicationHandleEvent
24  0x1b730790  PostPhotoViewController Release 1   00:19.254.047   0   UIKit   -[UIStoryboardScene dealloc]
25  0x1b730790  PostPhotoViewController Retain  2   00:19.254.119   0   UIKit   -[UINavigationController topViewController]
26  0x1b730790  PostPhotoViewController Autorelease     00:19.254.124   0   UIKit   -[UINavigationController topViewController]
27  0x1b730790  PostPhotoViewController Retain  3   00:19.254.935   0   UIKit   -[UINib instantiateWithOwner:options:]
28  0x1b730790  PostPhotoViewController Retain  4   00:19.254.944   0   UIKit   +[UIProxyObject addMappingFromIdentifier:toObject:forCoder:]
29  0x1b730790  PostPhotoViewController Retain  5   00:19.254.950   0   UIKit   -[UINib instantiateWithOwner:options:]
30  0x1b730790  PostPhotoViewController Retain  6   00:19.254.957   0   UIKit   +[UIProxyObject addMappingFromIdentifier:toObject:forCoder:]
31  0x1b730790  PostPhotoViewController Retain  7   00:19.254.993   0   UIKit   -[UIProxyObject initWithCoder:]
32  0x1b730790  PostPhotoViewController Retain  8   00:19.254.994   0   UIKit   -[UIRuntimeConnection initWithCoder:]
33  0x1b730790  PostPhotoViewController Retain  9   00:19.255.282   0   UIKit   -[UIRuntimeConnection initWithCoder:]
34  0x1b730790  PostPhotoViewController Retain  10  00:19.255.312   0   UIKit   -[UIRuntimeConnection initWithCoder:]
35  0x1b730790  PostPhotoViewController Retain  11  00:19.263.971   0   UIKit   -[UIProxyObject initWithCoder:]
36  0x1b730790  PostPhotoViewController Retain  12  00:19.263.971   0   UIKit   -[UIRuntimeConnection initWithCoder:]
37  0x1b730790  PostPhotoViewController Retain  13  00:19.264.922   0   UIKit   UINibDecoderDecodeObjectForValue
38  0x1b730790  PostPhotoViewController Retain  14  00:19.264.924   0   UIKit   UINibDecoderDecodeObjectForValue
39  0x1b730790  PostPhotoViewController Retain  15  00:19.264.939   0   UIKit   UINibDecoderDecodeObjectForValue
40  0x1b730790  PostPhotoViewController Retain  16  00:19.264.941   0   UIKit   UINibDecoderDecodeObjectForValue
41  0x1b730790  PostPhotoViewController Release 15  00:19.265.032   0   UIKit   -[UINib instantiateWithOwner:options:]
42  0x1b730790  PostPhotoViewController Release 14  00:19.265.046   0   UIKit   +[UIProxyObject removeMappingsForCoder:]
43  0x1b730790  PostPhotoViewController Release 13  00:19.265.049   0   UIKit   +[UIProxyObject removeMappingsForCoder:]
44  0x1b730790  PostPhotoViewController Release 12  00:19.265.060   0   UIKit   -[UINibDecoder finishDecoding]
45  0x1b730790  PostPhotoViewController Release 11  00:19.265.061   0   UIKit   -[UINibDecoder finishDecoding]
46  0x1b730790  PostPhotoViewController Release 10  00:19.265.076   0   UIKit   -[UINibDecoder finishDecoding]
47  0x1b730790  PostPhotoViewController Release 9   00:19.265.077   0   UIKit   -[UINibDecoder finishDecoding]
48  0x1b730790  PostPhotoViewController Release 8   00:19.265.095   0   UIKit   -[UINibDecoder finishDecoding]
49  0x1b730790  PostPhotoViewController Release 7   00:19.265.103   0   UIKit   -[UIRuntimeConnection dealloc]
50  0x1b730790  PostPhotoViewController Release 6   00:19.265.109   0   UIKit   -[UINibDecoder finishDecoding]
51  0x1b730790  PostPhotoViewController Release 5   00:19.265.118   0   UIKit   -[UIRuntimeConnection dealloc]
52  0x1b730790  PostPhotoViewController Release 4   00:19.265.126   0   UIKit   -[UIRuntimeConnection dealloc]
53  0x1b730790  PostPhotoViewController Release 3   00:19.265.133   0   UIKit   -[UIRuntimeConnection dealloc]
54  0x1b730790  PostPhotoViewController Release 2   00:19.265.548   0   Foundation  -[NSAutoreleasePool drain]
55  0x1b730790  PostPhotoViewController Retain  3   00:19.292.511   0   UIKit   -[UINavigationController topViewController]
56  0x1b730790  PostPhotoViewController Autorelease     00:19.292.517   0   UIKit   -[UINavigationController topViewController]
57  0x1b730790  PostPhotoViewController Retain  4   00:19.297.581   0   UIKit   -[UINavigationController topViewController]
58  0x1b730790  PostPhotoViewController Autorelease     00:19.297.585   0   UIKit   -[UINavigationController topViewController]
59  0x1b730790  PostPhotoViewController Retain  5   00:19.297.598   0   UIKit   -[UINavigationController _startTransition:fromViewController:toViewController:]
60  0x1b730790  PostPhotoViewController Release 4   00:19.297.619   0   UIKit   -[UINavigationController _startTransition:fromViewController:toViewController:]
61  0x1b730790  PostPhotoViewController Retain  5   00:19.297.957   0   UIKit   -[UINavigationController topViewController]
62  0x1b730790  PostPhotoViewController Autorelease     00:19.297.958   0   UIKit   -[UINavigationController topViewController]
63  0x1b730790  PostPhotoViewController Retain  6   00:19.298.000   0   UIKit   -[UIResponder becomeFirstResponder]
64  0x1b730790  PostPhotoViewController Release 5   00:19.298.015   0   UIKit   -[UIResponder becomeFirstResponder]
65  0x1b730790  PostPhotoViewController Release 4   00:19.302.098   0   QuartzCore  CA::AutoreleasePool::~AutoreleasePool()
66  0x1b730790  PostPhotoViewController Release 3   00:19.302.117   0   QuartzCore  CA::AutoreleasePool::~AutoreleasePool()
67  0x1b730790  PostPhotoViewController Release 2   00:19.302.696   0   QuartzCore  CA::AutoreleasePool::~AutoreleasePool()
68  0x1b730790  PostPhotoViewController Release 1   00:19.303.120   0   QuartzCore  CA::AutoreleasePool::~AutoreleasePool()
69  0x1b730790  PostPhotoViewController Retain  2   00:19.651.789   0   UIKit   -[UINavigationController topViewController]
70  0x1b730790  PostPhotoViewController Autorelease     00:19.651.789   0   UIKit   -[UINavigationController topViewController]
71  0x1b730790  PostPhotoViewController Retain  3   00:19.651.808   0   UIKit   -[UINavigationController topViewController]
72  0x1b730790  PostPhotoViewController Autorelease     00:19.651.809   0   UIKit   -[UINavigationController topViewController]
73  0x1b730790  PostPhotoViewController Retain  4   00:19.651.854   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
74  0x1b730790  PostPhotoViewController Release 3   00:19.651.862   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
75  0x1b730790  PostPhotoViewController Release 2   00:19.651.904   0   GraphicsServices    GSEventRunModal
76  0x1b730790  PostPhotoViewController Release 1   00:19.651.905   0   GraphicsServices    GSEventRunModal
77  0x1b730790  PostPhotoViewController Retain  2   00:20.841.683   0   UIKit   -[UINavigationController topViewController]
78  0x1b730790  PostPhotoViewController Autorelease     00:20.841.684   0   UIKit   -[UINavigationController topViewController]
79  0x1b730790  PostPhotoViewController Retain  3   00:20.841.704   0   UIKit   -[UINavigationController topViewController]
80  0x1b730790  PostPhotoViewController Autorelease     00:20.841.705   0   UIKit   -[UINavigationController topViewController]
81  0x1b730790  PostPhotoViewController Retain  4   00:20.841.706   0   UIKit   -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:]
82  0x1b730790  PostPhotoViewController Autorelease     00:20.841.707   0   UIKit   -[UINavigationController _popViewControllerWithTransition:allowPoppingLast:]
83  0x1b730790  PostPhotoViewController Retain  5   00:20.841.716   0   UIKit   -[UINavigationController setDisappearingViewController:]
84  0x1b730790  PostPhotoViewController Release 4   00:20.841.720   0   UIKit   _popViewControllerNormal
85  0x1b730790  PostPhotoViewController Retain  5   00:20.841.732   0   UIKit   -[UIViewController removeChildViewController:notifyDidMove:]
86  0x1b730790  PostPhotoViewController Release 4   00:20.841.733   0   UIKit   -[UIViewController removeChildViewController:notifyDidMove:]
87  0x1b730790  PostPhotoViewController Release 3   00:20.843.840   0   UIKit   _UIApplicationHandleEvent
88  0x1b730790  PostPhotoViewController Release 2   00:20.843.841   0   UIKit   _UIApplicationHandleEvent
89  0x1b730790  PostPhotoViewController Release 1   00:20.843.842   0   UIKit   _UIApplicationHandleEvent
90  0x1b730790  PostPhotoViewController Retain  2   00:20.844.155   0   UIKit   -[UINavigationController _startTransition:fromViewController:toViewController:]
91  0x1b730790  PostPhotoViewController Release 1   00:20.844.178   0   UIKit   -[UINavigationController _startTransition:fromViewController:toViewController:]
92  0x1b730790  PostPhotoViewController Retain  2   00:20.845.394   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
93  0x1b730790  PostPhotoViewController Release 1   00:20.845.396   0   UIKit   -[UINavigationController setDisappearingViewController:]
94  0x1b730790  PostPhotoViewController Retain  2   00:20.845.410   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
95  0x1b730790  PostPhotoViewController Release 1   00:20.845.429   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
96  0x1b730790  PostPhotoViewController Release 0   00:20.845.437   0   UIKit   -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
97  0x1b730790  PostPhotoViewController Zombie  -1  00:23.145.572   0   UIKit   -[UITabBarController _tabBarItemClicked:]

推荐答案

PostPhotoViewController由于某种原因被设置为UITabBarController委托.删除那些固定的东西.

PostPhotoViewController was getting set as the UITabBarController delegate for some reason. removing that fixed things.

这篇关于View Controller在发布后将消息发送给它,导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆