覆盖的 UIPickerView 在模拟器上实例化,但不在设备上实例化

发布于 2024-09-19 03:44:37 字数 706 浏览 5 评论 0原文

在我的项目中,我有一个 UIPickerView 的子类 A
在 Interface Builder 中,我有一个 UIPickerView,我已将其类型更改为我的子类 A
在另一个类 B 中,也在我的代码中定义,在 Interface Builder 中实例化并通过其出口链接到 A,它引用带有IBOutlet 字段A *mySubclass

问题是这样的:
在模拟器上运行时效果很好; BawakeFromNib 上的断点确认 mySubclass 已加载并且确实是 A 类型。 然而,当在设备(iPhone 4 上的 iOS4.1)上运行时,相同的断点显示 mySubclass 现在的类型为 UIPickerView

awakeFromNib 添加到子类 A 可以确认,在模拟器上运行时,A 的 awakeFromNib 会被调用,但在设备上运行时不会被调用。

有谁知道为什么会这样吗?

预先感谢您的帮助,

Teo

In my project I have a subclass A of a UIPickerView.
In Interface Builder I have a UIPickerView whose type I have changed to my subclass A.
In another class B, also defined in my code, instantiated in Interface Builder and linked to A via its outlet, it refers to A with an IBOutlet field A *mySubclass.

The problem is this:
When running on the simulator it works fine; A breakpoint on B’s awakeFromNib confirms that mySubclass has been loaded and is indeed of type A.
When running on the device (iOS4.1 on iPhone 4) however, the same breakpoint reveals that mySubclass is now of type UIPickerView.

Adding an awakeFromNib to subclass A confirms that when running on the simulator A’s awakeFromNib gets called but not when running on the device.

Has anyone any idea why this might be?

Thanks in advance for any help,

Teo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光暖心i 2024-09-26 03:45:01

更新:

经过几天的尝试,我最终开始在设备上尝试一些示例项目(有效),并最终创建了一个新项目,目的是迁移代码,以防项目本身以某种方式损坏。

将新项目命名为与有问题的项目相同后,我发现由于 UDID 不匹配,我无法运行它。

这让我通过 Xcode 管理器查看了设备上的应用程序,并注意到那里有两个相同的应用程序。删除那些使一切恢复正常。叹。很高兴它已经解决了,但如果有人知道到底发生了什么,我很想听听。

感谢您的关注,也很抱歉提出了一个不可能的问题,尽管阅读本文的任何人现在可能会尝试尽快从设备中删除有问题的应用程序。

最好的,特奥

An update:

After a couple of days of trying everything I eventually started trying some example projects on the device (which worked) and finally created a new project with the intention of migrating the code across in case the project itself had somehow gotten broken.

Having named the new project the same as the problematic one I noticed I couldn’t run it because of an UDID mismatch.

This caused me to have a look at the apps on the device through the Xcode organizer and noticed I had two of the same app on there. Deleting those made everything work again. Sigh. Glad it's sorted but if anyone has any idea exactly what happened I'd love to hear it.

Thanks for the eyeballs and sorry for asking an impossible problem although anyone reading this might now try removing the offending app from their device sooner rather than later.

Best, Teo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文