简体   繁体   English

我的应用程序在我的iPhone上运行时崩溃,但不在模拟器中崩溃。 我可以使用哪些调试技术来解决问题?

[英]My app crashes when running on my iPhone, but not in the simulator. What are some debugging techniques I can use to reso the issue?

The app crashes on the closing brace of viewDidLoad in the GameViewController . 该应用程序在GameViewControllerviewDidLoadGameViewController大括号中崩溃。 My viewDidLoad code looks like this: 我的viewDidLoad代码如下所示:

override func viewDidLoad() {
    super.viewDidLoad()

    let scene = GameScene(size: CGSize(width: 768, height: 1024))
    let skView = self.view as! SKView
    skView.showsFields = true
    skView.ignoresSiblingOrder = true
    skView.showsPhysics = true
    scene.scaleMode = .AspectFill
    skView.presentScene(scene)
  }

If I comment out the lines that create, scale, and present the GameScene then the app runs fine (it's essentially a blank view in this case). 如果我注释掉创建,缩放和呈现GameScene的行,那么应用程序运行正常(在这种情况下它本质上是一个空白视图)。 This tells me that there is obviously something going on in my GameScene class, but I cannot figure out exactly what. 这告诉我,我的GameScene课程中肯定发生了一些事情,但我无法弄明白究竟是什么。

When I run a backtrace, I get this: 当我运行回溯时,我得到了这个:

    (lldb) bt
* thread #1: tid = 0x1d9f18, 0x00000001002d5bac libglInterpose.dylib`EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned long, id<EAGLDrawable>) + 180, queue = 'com.apple.spritekit.renderQueue', stop reason = EXC_BAD_ACCESS (code=1, address=0x11f0)
    frame #0: 0x00000001002d5bac libglInterpose.dylib`EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned long, id<EAGLDrawable>) + 180
    frame #1: 0x0000000189252468 SpriteKit`-[SKView remakeFramebuffer:] + 600
    frame #2: 0x0000000189252e44 SpriteKit`-[SKView _setupContext] + 832
    frame #3: 0x0000000189253700 SpriteKit`-[SKView _renderContent] + 112
    frame #4: 0x00000001008a4f94 libdispatch.dylib`_dispatch_client_callout + 16
    frame #5: 0x00000001008af08c libdispatch.dylib`_dispatch_barrier_sync_f_invoke + 128
    frame #6: 0x00000001892535a0 SpriteKit`-[SKView renderContent] + 100
    frame #7: 0x0000000189254d24 SpriteKit`-[SKView layoutSubviews] + 564
    frame #8: 0x00000001893dd760 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 580
    frame #9: 0x0000000188d25e1c QuartzCore`-[CALayer layoutSublayers] + 152
    frame #10: 0x0000000188d20884 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 320
    frame #11: 0x0000000188d20728 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
    frame #12: 0x0000000188d1febc QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 276
    frame #13: 0x0000000188d1fc3c QuartzCore`CA::Transaction::commit() + 528
    frame #14: 0x000000018966c838 UIKit`-[UIApplication _reportMainSceneUpdateFinished:] + 60
    frame #15: 0x000000018966d71c UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 2804
    frame #16: 0x000000018966b778 UIKit`-[UIApplication workspaceDidEndTransaction:] + 184
    frame #17: 0x000000018d1a93c8 FrontBoardServices`__31-[FBSSerialQueue performAsync:]_block_invoke_2 + 32
    frame #18: 0x000000018495827c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
    frame #19: 0x0000000184957384 CoreFoundation`__CFRunLoopDoBlocks + 312
    frame #20: 0x00000001849559a8 CoreFoundation`__CFRunLoopRun + 1756
    frame #21: 0x00000001848812d4 CoreFoundation`CFRunLoopRunSpecific + 396
    frame #22: 0x000000018944c43c UIKit`-[UIApplication _run] + 552
    frame #23: 0x0000000189446fac UIKit`UIApplicationMain + 1488
  * frame #24: 0x0000000100046804 Ascii Attack`main + 164 at AppDelegate.swift:11
    frame #25: 0x000000019684aa08 libdyld.dylib`start + 4
(lldb) 

But unfortunately I do not know where to go from here. 但不幸的是,我不知道从哪里开始。 I'm not really sure how to decipher the backtrace. 我不太确定如何破译回溯。 I know that there is something wrong with my GameScene class, is there some way to figure out exactly what? 我知道,有什么问题我GameScene类,是有一些方法来找出到底是什么? Or do I have to test every property individually? 或者我必须单独测试每个房产?

In addition to this, it turns out the app runs fine on my iPhone when I don't run the app in the debugger. 除此之外,当我没有在调试器中运行应用程序时,我的iPhone上的app运行正常。

EDIT: The problem was resolved. 编辑:问题解决了。 It was apparently a bug with Xcode, not with any of my code. 这显然是Xcode的一个错误,而不是我的任何代码。 EXC_BAD_ACCESS at lauch for EAGLContext renderbufferStorage: fromDrawable: in Cocos2d app whie debugging 用于EAGLContext的EXC_BAD_ACCESS用于EAGLContext renderbufferStorage:fromDrawable:在Cocos2d app中进行调试

Turns out it was a bug with xcode rather than any code, as seen in this question: EXC_BAD_ACCESS at lauch for EAGLContext renderbufferStorage: fromDrawable: in Cocos2d app whie debugging . 事实证明这是一个xcode而不是任何代码的错误,如此问题所示: EAGLContext的EXC_BAD_ACCESS渲染缓冲存储:fromDrawable:在Cocos2d app中进行调试

Apparently EAGLcontext_renderBufferStorage can cause errors on iOS 8.3+. 显然EAGLcontext_renderBufferStorage会导致iOS 8.3+出错。 The solution to this is to change the scheme that you are using to disable GPU Frame Capture. 解决方案是更改您用于禁用GPU帧捕获的方案。 Not entirely sure why this works, but it does! 不完全确定为什么会这样,但确实如此!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的iPhone应用程序不会在新的iPhone 5模拟器中使用信箱运行。 我怎么把它拿到信箱? - My iPhone App won't run with letterboxes in the new iPhone 5 simulator. How do I get it to letterbox? 如何以编程方式确定我的应用程序是否在 iphone 模拟器中运行? - How can I programmatically determine if my app is running in the iphone simulator? 如何找出在模拟器中运行的应用突然崩溃的原因 - How can I find out why my app running in simulator abruptly crashes 在iPad3上运行应用程序时,在模拟器上没有变量,但变量没有显示。 斯威夫特4 - I get nil on a variable when running app on iPad3 but not on simulator. Swift 4 我的应用程序在模拟器上正常运行,但在我的 ios 13.2 iPhone 上崩溃 - My app runs properly on the simulator, but crashes on my ios 13.2 iPhone 无法在 ios 模拟器上运行我的 flutter 应用程序,该模拟器在 android 模拟器上完美运行。 运行 pod install 时出错 - Unable to run my flutter app on ios simulator which is working perfectly on android simulator. Error running pod install 在iPhone vs模拟器上运行应用程序时,应用程序崩溃 - App crashes when running app on iphone vs simulator 我无法解决(无法为模拟器构建我的应用程序。)颤动 - I can't solve (Could not build the my application for the simulator.) flutter 当我尝试运行项目并且未使用模拟器时,为什么iPhone模拟器显示“正在使用模拟器”? - Why does the iPhone simulator show “Simulator in use” when I try to run my project and the simulator is not in use? 在模拟器上下载我的应用程序。 Xcode - Download my application on the simulator. Xcode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM