Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 267
regeint Avatar asked Aug 11 '14 16:08

regeint


2 Answers

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

like image 81
Serge Maslyakov Avatar answered Nov 18 '22 18:11

Serge Maslyakov


Did you follow all the steps mentioned below ?

  1. Launch Xcode and either open an existing project, or create a new project. If you're new to iOS, create a Single View Application, and disable Use Storyboards but ensure that Use Automatic Reference Counting is on.
  2. Drag the GoogleMaps.framework bundle to the Frameworks group of your project. When prompted, select Copy items into destination group's folder.
  3. Right-click GoogleMaps.framework in your project, and select Show In Finder.
  4. Drag the GoogleMaps.bundle from the Resources folder to your project. We suggest putting it in the Frameworks group. When prompted, ensure Copy items into destination group's folder is not selected.
  5. Select your project from the Project Navigator, and choose your application's target. Open the Build Phases tab, and within Link Binary with Libraries, add the following frameworks: AVFoundation.framework
    CoreData.framework
    CoreLocation.framework
    CoreText.framework
    GLKit.framework
    ImageIO.framework
    libc++.dylib
    libicucore.dylib
    libz.dylib
    OpenGLES.framework
    QuartzCore.framework
    SystemConfiguration.framework

Choose your project, rather than a specific target, and open the Build Settings tab. In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All. Finally, add your API key to your AppDelegate.

#import <GoogleMaps/GoogleMaps.h>

Add the following to your application:didFinishLaunchingWithOptions: method, replacing API_KEY with your API key.

[GMSServices provideAPIKey:@"API_KEY"];

Source: Google

like image 24
Dileep Mettu Avatar answered Nov 18 '22 16:11

Dileep Mettu