I am trying to use the Google Maps SDK in my app. So far, I have linked all the frameworks. I am pretty sure I have added the appropriate -ObjC
flags as per the instructions. However, when I copied and pasted their code into my ViewController.m
class, I get the following errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GMSCameraPosition", referenced from:
objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSMapView", referenced from:
objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSMarker", referenced from:
objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSServices", referenced from:
objc-class-ref in FoothillTourAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
"FoothillTourViewController"
is the name of my ViewController
class.
Here is the code for my View Controller class. The code is taken straight from the instructions.
#import "FoothillTourViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@implementation FoothillTourViewController {
GMSMapView *mapView_;
}
// You don't need to modify the default initWithNibName:bundle: method.
- (void)loadView {
//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];
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_;
}
Any help would be greatly appreciated as I have been spending hours trying to figure out what is happening. I'm guessing its a stupid mistake, but I can't put my finger on it. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…