title: Adding google maps as subview crashes iOS app with exc_bad
body: <p>I have code that worked perfectly fine until around 3 days ago. I have tried going back to a much older commit that worked a 100% and still now it crashes with exc_bad.
  The crash only happens when running the app on the device, If I run the app on the simulator or use instruments to run the app on the device it runs perfectly fine. When I changed my google api key, it said "You might not have permission to use this api key" but no longer crashed.</p>
  
  <p>The app only crashes when running the app on the device via xcode. When later running the same version on the device without being connected to xcode it works fine.</p>
  
  <p>I am not sure what information I can add here to help debug the problem. I have recently updated xcode to 6.4 and updated the OSX with the latest update.</p>
  
  <p>I am using google 1.10.1 sdk version, installed using CocoaPods</p>
  
  <p>The code I use to add the map:</p>
  
  <pre><code>self.mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
  
  self.mapView.myLocationEnabled = YES;
  self.mapView.settings.myLocationButton = YES;
  self.mapView.delegate = self;
  
  [self.mapView addObserver:self
                 forKeyPath:@"myLocation"
                    options:NSKeyValueObservingOptionNew
                    context:NULL];
  
  [self.view insertSubview:self.mapView atIndex:1];
  </code></pre>
  
  <p>The error itself varies between code=1, code=2, and code=257. I have tried adding the GMSMapView with storyboard instead of code. I have tried installing an older version of xcode and running again but it doesn't change anything.</p>
  
  <p>If I comment out the insert subview line, that app doesn't crash. I have tried running the zombie instrument tool but when I run using instruments the app works fine.</p>
  
  <pre><code>#0  0x0000000100c5dc34 in EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned long, id&lt;EAGLDrawable&gt;) ()
  #1  0x00000001002404c0 in gmscore::renderer::ios::GLRenderTarget::CreateFramebuffer() ()
  #2  0x00000001002403cc in gmscore::renderer::ios::GLRenderTarget::FrameStart() ()
  #3  0x00000001002e7af4 in gmscore::renderer::EntityRenderer::Draw(bool) ()
  #4  0x00000001002516f4 in -[GMSPhoenixRenderer drawIfNeeded] ()
  #5  0x00000001002329a0 in -[GMSEntityRendererView draw] ()
  #6  0x000000010028dc74 in -[GMSDisplayLink displayLinkFired:] ()
  #7  0x0000000100c5ca9c in -[DYDisplayLinkInterposer forwardDisplayLinkCallback:] ()
  #8  0x00000001887f629c in CA::Display::DisplayLinkItem::dispatch() ()
  #9  0x00000001887f6134 in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
  #10 0x00000001855d1470 in IODispatchCalloutFromCFMessage ()
  #11 0x00000001843c2dc4 in __CFMachPortPerform ()
  #12 0x00000001843d7a54 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
  #13 0x00000001843d79b4 in __CFRunLoopDoSource1 ()
  #14 0x00000001843d5934 in __CFRunLoopRun ()
  #15 0x00000001843012d4 in CFRunLoopRunSpecific ()
  #16 0x000000018db1f6fc in GSEventRunModal ()
  #17 0x0000000188ec6fac in UIApplicationMain ()
  #18 0x000000010002d794 in main at /Users/yoavschwartz/Documents/donkey_republic_ios/DonkeyRepublic/DonkeyRepublic/main.m:14
  #19 0x0000000196272a08 in start ()
  </code></pre>
  
  <p>This problem seemed to have solved itself when restarting computer/device and now popped again. I really don't understand what's going on.</p>