Undefined symbols for architecture armv7 while using Google-Maps-iOS-SDK (1.8.1)

regeint picture regeint · Aug 11, 2014 · Viewed 9k times · Source

I am trying to add Google-Maps-iOS-SDK (1.8.1) using cocoapods (0.33.1).

Deployment target version: iOS 7.0

I have added this pod: pod 'Google-Maps-iOS-SDK', '~> 1.8' Downloaded and installed sdk properly.

I started adding header file and sample map view loading code from here.

I have properly added API keys. In one view controller's - (void)viewDidLoad,
I have added following code:

 // Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
GMSMapView *mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;

// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_; 

I got this error on build for iPhone (not in simulator)

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GMSMarker", referenced from: objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSMapView", referenced from: objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSCameraPosition", referenced from: objc-class-ref in DealDetailsViewController.o "_OBJC_CLASS_$_GMSServices", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also tried using google map iOS sdk manual installation (without cocoapods). I have also added linker flag: -ObjC. It builds fine but crash on runtime showing selector not found error like this:

an NSException is thrown with the description - -[GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance.

I just need to use google map iOS SDK either using cocoapod or from manual installation.

Am I missing anything here?

Edit

If there is anything related with Pods.xcconfig then here is the content of that file:

FRAMEWORK_SEARCH_PATHS = "$(PODS_ROOT)/Google-Maps-iOS-SDK" "$(PODS_ROOT)/Parse-iOS-SDK"
    GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
    HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Bolts" "${PODS_ROOT}/Headers/Facebook-iOS-SDK" "${PODS_ROOT}/Headers/Facebook-iOS-SDK/FacebookSDK" "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK" "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK/GoogleMaps" "${PODS_ROOT}/Headers/MBProgressHUD" "${PODS_ROOT}/Headers/Parse-iOS-SDK" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/WYPopoverController"

    OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/Bolts" -isystem "${PODS_ROOT}/Headers/Facebook-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Facebook-iOS-SDK/FacebookSDK" -isystem "${PODS_ROOT}/Headers/Google-

    Maps-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Google-Maps-iOS-SDK/GoogleMaps" -isystem "${PODS_ROOT}/Headers/MBProgressHUD" -isystem "${PODS_ROOT}/Headers/Parse-iOS-SDK" -isystem "${PODS_ROOT}/Headers/Reachability" -isystem "${PODS_ROOT}/Headers/WYPopoverController"

    OTHER_LDFLAGS = -ObjC -lc++ -licucore -lsqlite3 -lz -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreData -framework CoreGraphics -framework CoreLocation -framework CoreText -framework GLKit -framework GoogleMaps -framework ImageIO -framework MobileCoreServices -framework OpenGLES -framework Parse -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -weak_framework Accounts -weak_framework AdSupport -weak_framework Security -weak_framework Social
    PODS_ROOT = ${SRCROOT}/Pods

Answer

Serge Maslyakov picture Serge Maslyakov · Aug 14, 2014

It's looks like the linker cannot find a sdk lib. Headers are present, but sdk objects-file not linked to a project.

Checking this:

BuildSettings->Linking->Other Linker Flags must have a value $(inherited)

See image