我的代码在大约 3 天前运行良好。我尝试回到一个更早的提交,它工作了 100%,但现在它仍然与 exc_bad 一起崩溃。 只有在设备上运行应用程序时才会发生崩溃,如果我在模拟器上运行应用程序或使用仪器在设备上运行应用程序,它运行得非常好。当我更改我的 google api key 时,它说“您可能无权使用此 api key ”但不再崩溃。
该应用仅在通过 xcode 在设备上运行应用时崩溃。稍后在设备上运行相同版本而不连接到 xcode 时,它可以正常工作。
我不确定我可以在此处添加哪些信息来帮助调试问题。我最近将 xcode 更新到 6.4 并使用最新更新更新了 OSX。
我使用的是google 1.10.1 sdk版本,使用CocoaPods安装
我用来添加 map 的代码:
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=1、code=2 和 code=257 之间变化。我尝试使用 Storyboard 而不是代码添加 GMSMapView。我已经尝试安装旧版本的 xcode 并再次运行,但它并没有改变任何东西。
如果我注释掉插入 subview 行,该应用程序不会崩溃。我曾尝试运行僵尸仪器工具,但当我使用仪器运行时,该应用程序运行良好。
#0 0x0000000100c5dc34 in EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned long, id<EAGLDrawable>) ()
#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 ()
重新启动计算机/设备时,此问题似乎已自行解决,现在再次弹出。我真的不明白这是怎么回事。
最佳答案
编辑:我找到了问题的根源并找到了解决方法:
问题似乎是由 XCode 中的 OpenGL ES Frame Capture 触发的;我猜这个问题是从 Apple 在 XCode 6.4/iOS 8.3 中添加 Metal 时开始的,可能会对整个帧捕获调试系统产生不利影响。
解决方法:
- 在 XCode 中,转到 Product > Scheme > Edit Scheme...
- 选择左侧的“运行”选项卡。
- 选择顶部的“选项”子标签。
- 将“GPU 帧捕获”从“自动启用”或“OpenGL ES”更改为“金属”或“禁用”。
这会禁用 OpenGL ES 帧捕获,这不是很好,但允许您继续调试您的构建。
不确定这个问题是 Apple 还是 Google 的,但我会向两者发布错误报告。编码愉快!
--
较早的帖子:
我也遇到了一些进一步的信息(可以对此发表评论,但还没有代表);据我所知:
- 这个问题在 XCode 6.4 和 XCode 7 beta 3 中很明显
- 它仅在 Debug模式下呈现,不在 XCode 之外运行。
- 它不会在 iOS 8.1.2 上显示,但会在 iOS 8.3 上显示。
- Google Maps 1.9.X(作为框架文件导入)和 1.10.X(作为 CocoaPod 导入,包括最新版本)都会出现这种情况
- 我还不能完全验证这一点,但它还没有出现在 XCode 6.3.2 中;这可能是因为我无法在该版本中编译 8.3。
我可能会错过赃物赏金的截止日期,但我明天会花一整天时间深入挖掘并报告。
关于ios - 将谷歌地图添加为 subview 会使 iOS 应用程序因 exc_bad 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31264537/