0

我是 Objective-C 编程的新手。我正在为一个项目做“google map sdk tutorial”。但它一直给我带来这个错误:

2013-09-08 21:49:14.670 map-sdk-test1[709:c07] +[GMSCameraPosition cameraWithLatitude:longitude:zoom:]: unrecognized selector sent to class 0x2fcc40
2013-09-08 21:49:14.674 map-sdk-test1[709:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GMSCameraPosition cameraWithLatitude:longitude:zoom:]: unrecognized selector sent to class 0x2fcc40'
*** First throw call stack:
(0x258dd72 0x23b6e51 0x2619f0d 0x257d9dc 0x257d76e 0x29f3 0x143b0d4 0x143b30e 0x13911fb 0x13914f6 0x139168c 0x1399871 0x26fd 0x13602dc 0x13608c9 0x136196a 0x13722be 0x1372f9f 0x13653fd 0x304cf39 0x304cc10 0x2503da5 0x2503b12 0x2534b46 0x2533ed4 0x2533dab 0x136128f 0x1362e71 0x240d 0x2335)
libc++abi.dylib: terminate called throwing an exception

这是我正在做的教程:https ://developers.google.com/maps/documentation/ios/start

我一步一步地跟着它。

这是发生错误的代码:

    #import "ViewController.h"
    #import <GoogleMaps/GoogleMaps.h>

    @implementation ViewController {
    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:5];


     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_;
      }
  - (void)didReceiveMemoryWarning 
      {
     [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
     }

      - (BOOL)shouldAutorotateToInterfaceOrientation:     (UIInterfaceOrientation)interfaceOrientation
     {
      return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
      }

       @end 

问候

4

2 回答 2

1

我在构建设置中解决了它:):其他链接器标志;我添加了这个 -all_load

于 2013-11-01T21:44:07.440 回答
0

我今天看到了这个问题。问题是我错过了在其他链接器标志中添加 -ObjC 标志的步骤。

于 2013-09-11T06:38:20.123 回答