Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS5 Stable App Crashing in iOS4.3 Simulator

i am getting an NSInvalidArgumentException with reason: -[UITapGestureRecognizer initWithCoder:]: unrecognized selector sent to instance

my understanding was that UITapGestureRecognizers were supported in ios4.x?

is it possible to load a different xib file for sub ios5 versions?

like image 254
Andy Avatar asked Jan 26 '12 14:01

Andy


2 Answers

As @mit3z states in his comment on the original question, iOS 4.3 supports this feature only when setup up manually with code. It is not supported with Interface Builder.

Apple would have saved us all grief over this if they simply added this as a build-time warning.

like image 181
benvolioT Avatar answered Jan 03 '23 13:01

benvolioT


I think you have a NSCoding compliant object that is deallocated before the crash. The UITapGestureRecognizer is allocated at its address and when the disappeared object (but not its reference) tries to call initWithCoder on itself, it actually calls this method on your gestureRecognizer instead.

Then your problem comes from that deallocated object but not from your gestureRecognizer.

Be sure to retain all your IBOutlet properties.

like image 30
Vincent Zgueb Avatar answered Jan 03 '23 15:01

Vincent Zgueb