Search code examples
xcodeios5segueuitapgesturerecognizernszombie

UITapGestureRecognizer crashing as a zombie during segue


I'm getting a strange crash. I have a UITableViewController that segues to another tableview controller with context.

When clicking on a cell, I get a crash with this message:

[UITapGestureRecognizer retain]: message sent to deallocated instance 0x8700af0

So I ran zombies instruments and here's what it's showing:

#   Address Category    Event Type  RefCt   Timestamp   Size    Responsible Library Responsible Caller
0   0xf5f36c0   UITapGestureRecognizer  Malloc  1   00:04.128.790   80  UIKit   UINibDecoderDecodeObjectForValue
1   0xf5f36c0   UITapGestureRecognizer  Retain  2   00:04.128.807   0   UIKit   -[UIRuntimeConnection initWithCoder:]
2   0xf5f36c0   UITapGestureRecognizer  Retain  3   00:04.128.880   0   UIKit   UINibDecoderDecodeObjectForValue
3   0xf5f36c0   UITapGestureRecognizer  Retain  4   00:04.128.959   0   UIKit   -[UIRuntimeConnection initWithCoder:]
4   0xf5f36c0   UITapGestureRecognizer  Retain  5   00:04.129.007   0   UIKit   UINibDecoderDecodeObjectForValue
5   0xf5f36c0   UITapGestureRecognizer  Retain  6   00:04.129.017   0   UIKit   UINibDecoderDecodeObjectForValue
6   0xf5f36c0   UITapGestureRecognizer  Retain  7   00:04.129.079   0   UIKit   -[UINib instantiateWithOwner:options:]
7   0xf5f36c0   UITapGestureRecognizer  Release 6   00:04.129.111   0   UIKit   -[UINibDecoder finishDecoding]
8   0xf5f36c0   UITapGestureRecognizer  Release 5   00:04.129.124   0   UIKit   -[UINibDecoder finishDecoding]
9   0xf5f36c0   UITapGestureRecognizer  Release 4   00:04.129.130   0   UIKit   -[UINibDecoder finishDecoding]
10  0xf5f36c0   UITapGestureRecognizer  Release 3   00:04.129.135   0   UIKit   -[UINibDecoder finishDecoding]
11  0xf5f36c0   UITapGestureRecognizer  Release 2   00:04.129.139   0   UIKit   -[UIRuntimeConnection dealloc]
12  0xf5f36c0   UITapGestureRecognizer  Release 1   00:04.129.144   0   UIKit   -[UIRuntimeConnection dealloc]
13  0xf5f36c0   UITapGestureRecognizer  Release 0   00:04.130.131   0   Foundation  __NSFireDelayedPerform
14  0xf5f36c0   UITapGestureRecognizer  Zombie  -1  00:04.131.132   0   UIKit   -[UINib instantiateWithOwner:options:]

The tapGestureRecognizer is added via IB, declared as weak. Someone suggested to not set it to nil in ViewDidUnload, so I commented that out.

Now, if I go to another tab in tab controller and do some segues there and come back to this first table view controller that is experiencing the crash, there is no crash, everything segues perfectly.

Also in the controller that is crashing, I have two different types of objects displayed, some are just text, some are images. Only images are crashing. Text cells are seguing just fine.

I am running this on iOS5 & iOS5.1. Happens both on phone and simulator. This does not crash on iOS6 device or iOS6.1 simulator.

Does anyone have any idea what is happening here?


Solution

  • so far the solution was to delete the gesture recognizer from the controller I was seguing to, which seemed to cause the issue.