添加谷歌地图作为子视图与exc_bad崩溃的iOS应用程序 [英] Adding google maps as subview crashes iOS app with exc_bad

查看:197
本文介绍了添加谷歌地图作为子视图与exc_bad崩溃的iOS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在3天前大概工作得很好。我已经试过回到一个100%的更老的提交,现在仍然与exc_bad崩溃。
只有在设备上运行应用程序时才会发生崩溃,如果我在模拟器上运行应用程序或使用仪器在设备上运行应用程序,它会非常好地运行。当我更改了我的Google API key时,它说您可能没有权限使用此API密钥,但不会再崩溃。



该应用只在运行应用时崩溃在设备上通过xcode。当以后在设备上运行相同版本而未连接到xcode时,它可以正常工作。



我不确定可以在此处添加哪些信息来帮助调试问题。我最近更新了xcode到6.4,并更新了OSX的最新更新。



我使用的是谷歌1.10.1 sdk版本,使用CocoaPods安装



我用来添加地图的代码:

$ p $ self $ map = [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];

错误本身在代码= 1,代码= 2和代码= 257之间变化。我曾尝试将GMSMapView与故事板而不是代码相加。我已经尝试安装旧版本的xcode并重新运行,但它不会改变任何内容。



如果我注释掉插入子视图行,该应用程序不会崩溃。 EAGLContext_renderbufferStorageFromDrawable中的#0 0x0000000100c5dc34(EAGLContext)。我试过运行僵尸工具工具, *,objc_selector *,unsigned long,id< EAGLDrawable>)()
#1 0x00000001002404c0 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在CA :: Display :: DisplayLink :: dispatch_items(unsigned long long,unsigned l ()
#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 0x2000001843d5934 in __CFRunLoopRun()
#15 CFRunLoopRunSpecific()中的0x00000001843012d4
#16 GSEventRunModal()中的0x000000018db1f6fc
#17 UIApplicationMain()中的0x0000000188ec6fac
#18 0x000000010002d794 in /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的时候开始的,可能会对整个帧捕获调试系统产生不利影响。

>解决方法:


  1. 在XCode中,转至产品>计划>编辑计划...

  2. 选择左侧的运行标签。

  3. 选择顶部的选项子选项卡。将GPU Frame Capture从自动启用或OpenGL ES更改为Metal或Disabled。

OpenGL ES帧捕获,这不是很好,但允许您继续调试您的构建。



不知道这个问题是Apple还是Google的,但我会发布错误报告给两者。 Happy code!



-



之前的帖子:

一些进一步的信息(会使这个评论,但没有代表相当尚未),因为我也经历了这一点;最好的我可以告诉:


  • 这个问题在XCode 6.4以及XCode 7 beta 3中很明显

  • 它仅以调试模式呈现,不在XCode外部运行。
  • 它不会在iOS 8.1.2上显示,而会在iOS 8.3上显示。

  • 它既适用于Google Maps 1.9.X(作为框架文件导入),也适用于1.10.X(作为CocoaPod导入,包括最新版本)。

  • 我可以不能完全验证这一点,但它并没有在XCode 6.3.2中显示出来;这可能是因为我无法在该版本中编译为8.3。


    我可能会错过赃款的截止日期,但我明天花一整天的时间去深入挖掘,并会回报。

    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.

    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.

    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.

    I am using google 1.10.1 sdk version, installed using CocoaPods

    The code I use to add the 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];
    

    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.

    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.

    #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 ()
    

    This problem seemed to have solved itself when restarting computer/device and now popped again. I really don't understand what's going on.

    解决方案

    EDIT: I've found the root of the problem and have a workaround:

    The problem seems to be triggered by OpenGL ES Frame Capture in XCode; I'm guessing this problem started when Apple added Metal to the mix as of XCode 6.4/iOS 8.3, perhaps somehow adversely affecting the entire frame capture debugging system.

    The workaround:

    1. In XCode, go to Product > Scheme > Edit Scheme...
    2. Select the "Run" Tab on the left.
    3. Select the "Options" sub-tab on the top.
    4. Change "GPU Frame Capture" from "Automatically Enabled" or "OpenGL ES" to either "Metal" or "Disabled".

    This disables OpenGL ES frame capture, which isn't great, but allows you to continue debugging your builds.

    Not sure if this issue is Apple's or Google's but I'll be posting bug reports to both. Happy coding!

    --

    earlier post:

    Some further info (would make this a comment but don't have the rep quite yet) as I'm experiencing this too; as best I can tell:

    • The issue is apparent in XCode 6.4 as well as XCode 7 beta 3
    • It presents itself in debug mode only, not running outside XCode.
    • It doesn't manifest on iOS 8.1.2 but it does on iOS 8.3.
    • It happens with both Google Maps 1.9.X (imported as a Framework file) as well as 1.10.X (imported as a CocoaPod, including the latest)
    • I can't verify this completely yet but it hasn't shown up in XCode 6.3.2 for me; this might be because I can't compile for 8.3 in that version.

    I'll likely miss the deadline for the swag bounty but I'm spending all day tomorrow digging deeper and will report back.

    这篇关于添加谷歌地图作为子视图与exc_bad崩溃的iOS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆