x2on
x2on

Reputation: 2297

XCode 4.3 builds iOS Apps with wrong linked dylibs (Symbol not found: _OBJC_CLASS_$_CLGeocoder)

XCode 4.3 builds iOS Apps in Release Configuration with wrong linked dylibs (see error at the bottom).

The app crashes immediately after starting on device.

Building the app with xcodebuild on cli or with Xcode 4.2.1 works.

The app is linked again CoreLocation (and in the target) and on iOS 5.x CLGeocoder is used. On iOS 4.x MKReverseGeoCoder is used. ( NSClassFromString() returns a class even when class should not be available)

It only happens if you build an archive and share the app as an IPA File. Immediately after starting the app on an iOS-Device (4.x).

Dyld Error Message:   Symbol not found: _OBJC_CLASS_$_CLGeocoder   
Referenced from: /var/mobile/Applications/*********/AppName.app/AppName
Expected in: /System/Library/Frameworks/CoreLocation.framework/CoreLocation  
in /var/mobile/Applications/*********/AppName.app/AppName
Dyld Version: 179.7

How can I get rid of this error?

Upvotes: 1

Views: 2033

Answers (2)

Kevin James Hunt
Kevin James Hunt

Reputation: 333

I was receiving the same error, even after trying the solution posted by bllubbor on the thread you linked to in your question:

if (NSClassFromString(@"CLGeocoder") && 
    [NSClassFromString(@"CLGeocoder") instancesRespondToSelector:
@selector(reverseGeocodeLocation:completionHandler:) ]) {

                        //iOS 5 or later    
  }

I was able to resolve it by ALSO making sure that the CoreLocation framework was weakly linked (i.e. set to Optional instead of Required) in the target's build settings.

Upvotes: 4

Pieter
Pieter

Reputation: 1831

Add the CoreLocation framework to your project bundle.

Upvotes: 3

Related Questions