iOS5 稳定应用程序在 iOS4.3 模拟器中崩溃
我收到 NSInvalidArgumentException ,原因是: -[UITapGestureRecognizer initWithCoder:]: 无法识别的选择器发送到实例
我的理解是 ios4.x 支持 UITapGestureRecognizers?
是否可以为 ios5 子版本加载不同的 xib 文件?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 @mit3z 在对原始问题的评论中指出的那样,iOS 4.3 仅在使用代码手动设置时才支持此功能。 Interface Builder 不支持它。
如果苹果只是将其添加为构建时警告,那么他们就可以避免我们对此的悲伤。
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.
我认为您有一个符合 NSCoding 的对象,该对象在崩溃之前已被释放。 UITapGestureRecognizer 在其地址上分配,当消失的对象(但不是其引用)尝试对其自身调用 initWithCoder 时,它实际上会在您的gestureRecognizer 上调用此方法。
那么您的问题来自该已释放的对象,而不是来自您的gestureRecognizer。
请务必保留您的所有 IBOutlet 属性。
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.