【问题标题】:unrecognized selector sent to class error:google maps sdk code无法识别的选择器发送到类错误:google maps sdk 代码
【发布时间】:2013-11-02 05:44:07
【问题描述】:

我是 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 

问候

【问题讨论】:

  • 能否贴出部分代码,出现错误的地方?
  • @RaúlJuárez 我发布了代码
  • 我在构建设置中解决了 :) :其他链接器标志;我添加了这个 -all_load

标签: ios objective-c google-maps


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2013-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多