View Controller getting a message sent to it after

2019-06-04 01:50发布

问题:

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.

This is the crash message:

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

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?

here's the zombies readout:

#   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:]

回答1:

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