Z S
Z S

Reputation: 7501

iOS: "Symbol not found" error on some iOS4 devices, but not all

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?

Upvotes: 0

Views: 560

Answers (2)

Daniel Wood
Daniel Wood

Reputation: 4537

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.

Upvotes: 0

Conrad Shultz
Conrad Shultz

Reputation: 8808

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:

if ([NSMetadataQuery class] != nil) {
    // Use the class
}

Upvotes: 1

Related Questions