簡體   English   中英

無法識別的選擇器發送給類錯誤:google maps sdk代碼

[英]unrecognized selector sent to class error:google maps sdk code

我是Objective-C編程的新手。 我正在為一個項目做“ google map sdk教程”。 但是它不斷給我帶來這個錯誤:

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 

問候

我今天看到了這個問題。 問題是我錯過了在其他鏈接器標志中添加-ObjC標志的步驟。

我在建築設置中解決了它:)其他鏈接器標志; 我添加了這個-all_load

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM