0

i got this error while trying to initialize a Google Map with the iOS SKD with Objetive-c doing the code in the documentation https://developers.google.com/maps/documentation/ios-sdk/.

2016-06-10 08:42:24.585 XXXXXApp[11103:451806] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010b33ed85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010adb2deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010b23b23e -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318
    3   CoreFoundation                      0x000000010b24d5bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
    4   UIKit                               0x00000001094ff287 -[UIButton _intrinsicSizeWithinSize:] + 1478
    5   UIKit                               0x00000001091f11ad -[UIView(Geometry) sizeToFit] + 253
    6   XXXXXApp                            0x0000000105c23ba0 -[GMSUISettingsView init] + 425
    7   XXXXXApp                            0x0000000105bab236 -[GMSUISettings initWithMapView:vectorMapView:] + 222
    8   XXXXXApp                            0x0000000105b9b053 -[GMSMapView sharedInitWithServices:camera:forPlaces:] + 1930
    9   XXXXXApp                            0x0000000105b99fdc -[GMSMapView initWithFrame:camera:] + 124
    10  XXXXXApp                            0x0000000105b99e01 +[GMSMapView mapWithFrame:camera:] + 104

The line: [GMSMapView mapWithFrame:CGRectZero camera:camera] is where all fails.

- (void)viewDidLoad {
      [super viewDidLoad];
      GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
                                                              longitude:151.2086
                                                                   zoom:6];
      GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];

      GMSMarker *marker = [[GMSMarker alloc] init];
      marker.position = camera.target;
      marker.snippet = @"Hello World";
      marker.appearAnimation = kGMSMarkerAnimationPop;
      marker.map = mapView;

      self.view = mapView;
}

I tried this code in the --loadView-- method and the issue still continue.

Jooz
  • 1
  • Check this related questions: http://stackoverflow.com/questions/15087364/cant-assign-a-google-maps-map-to-custom-view and http://stackoverflow.com/questions/15675402/how-to-set-the-frame-for-mapview-in-google-gmsmap-for-ios6 – abielita Jun 11 '16 at 08:46
  • that error was caused by external category that add place holder to label components. – Jooz Sep 29 '16 at 17:41

0 Answers0