iOS:“找不到符号”部分 iOS4 设备上出现错误,但并非全部
我在用户的崩溃日志中收到以下消息:
Dyld 错误消息:未找到符号:_OBJC_CLASS_$_NSMetadataQuery
所以我理解解决方案是我应该将基础框架设置为“可选”。但令我感到奇怪的是,这种崩溃只发生在某些 iOS4 设备上,而不会发生在其他设备上,而且在 4.3 模拟器中也不会崩溃。这种情况只发生在 iPad(运行 iOS4)上,但即便如此,也只发生在其中一些设备上。有人可以解释为什么会这样吗?
如果这是链接框架的错误,它应该在所有 iOS4 设备(或至少所有 iPad)上崩溃,对吧?
I'm getting the following message in my users' crash logs:
Dyld Error Message: Symbol not found: _OBJC_CLASS_$_NSMetadataQuery
So I understand the solution is that I should be making the Foundation framework "Optional". But what's bizzare to me is this crash only happens on some iOS4 devices, but not others, and it doesn't crash in the 4.3 simulator either. It's only happening on iPads (running iOS4) specifically, but even then, it's only on some of them. Can someone explain why that might be?
If it's a bug with linking frameworks, it should crash on all iOS4 devices (or at least all iPads), right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSMetadataQuery 可在 iOS >= 5.0 上使用,我假设您知道这一点,因为您正在谈论框架的弱链接。
首先,您可能不需要再这样做了。
由于这是在运行时发生的,并且是不可重复的,所以听起来您的逻辑不一致。您是否在任何地方使用 NSMetadataQuery 而不首先确保该类存在?你的代码应该用这样的惯用法来包装:
NSMetadataQuery is available on iOS >= 5.0, which I assume you know since you are talking about weak-linking the framework.
First off, you probably don't need to do that any more.
Since this is occurring at run-time, and non-reproducibly, it sounds like an inconsistency in your logic. Is there anywhere you use NSMetadataQuery without first ensuring the class exists? Your code should be wrapped in an idiom like:
我有这个确切的错误。这不是逻辑问题,因为它在调用 App Delegate 之前就崩溃了,而且我对 NSMetadataQuery 的使用在生命周期中要晚得多。
事实证明,基金会框架需要弱链接。
I had this exact error. It wasn't a case of logic as it was crashing before the App Delegate was even called and my usage of
NSMetadataQuery
was much later in the life cycle than that.It turns out that weak linking the Foundation framework was required.