Ios 我的应用程序在iPhone上运行时崩溃,但在模拟器中没有。我可以使用哪些调试技术来解决这个问题?
应用程序在Ios 我的应用程序在iPhone上运行时崩溃,但在模拟器中没有。我可以使用哪些调试技术来解决这个问题?,ios,iphone,xcode,swift,debugging,Ios,Iphone,Xcode,Swift,Debugging,应用程序在GameViewController中的viewDidLoad的右括号上崩溃。我的viewDidLoad代码如下所示: override func viewDidLoad() { super.viewDidLoad() let scene = GameScene(size: CGSize(width: 768, height: 1024)) let skView = self.view as! SKView skView.showsFields = t
GameViewController
中的viewDidLoad
的右括号上崩溃。我的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)
}
如果我注释掉创建、缩放和呈现游戏场景的行,那么应用程序运行良好(在本例中,它基本上是一个空白视图)。这告诉我,在我的游戏场景
类中显然发生了一些事情,但我不能确切地知道是什么
当我运行回溯跟踪时,我得到:
(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)
(lldb)bt
*线程#1:tid=0x1d9f18,0x00000001002d5bac libglInterpose.dylib`EAGLContext\u renderbufferStorageFromDrawable(EAGLContext*,objc\u选择器*,无符号长,id)+180,队列='com.apple.spritekit.renderQueue',停止原因=EXC\u坏访问(代码=1,地址=0x11f0)
帧#0:0x00000001002d5bac libglInterpose.dylib`EAGLContext\u renderbufferStorageFromDrawable(EAGLContext*,objc_选择器*,无符号长,id)+180
帧#1:0x0000000189252468 SpriteKit`-[SKView remakeFramebuffer:+600
帧#2:0x0000000189252e44 SpriteKit`-[SKView\U setupContext]+832
帧#3:0x0000000189253700 SpriteKit`-[SKView渲染内容]+112
帧4:0x00000001008a4f94 libdispatch.dylib`\u dispatch\u client\u callout+16
帧5:0x00000001008af08c libdispatch.dylib`\u dispatch\u barrier\u sync\u f\u invoke+128
帧#6:0x00000001892535a0 SpriteKit`-[SKView渲染内容]+100
帧#7:0x0000000189254d24 SpriteKit`-[SKView layoutSubviews]+564
帧#8:0x00000001893dd760 UIKit`-[UIView(CALayerDelegate)布局层的子层:+580
帧#9:0x0000000188d25e1c QuartzCore`-[CALayer layoutSublayers]+152
帧#10:0x0000000188d20884 QuartzCore`CA::Layer::layout_(如果需要)(CA::Transaction*)+320
帧#11:0x0000000188d20728 QuartzCore`CA::Layer::layout_和_display_(如果需要)(CA::Transaction*)+32
帧#12:0x0000000188d1febc QuartzCore`CA::Context::commit#u事务(CA::transaction*)+276
帧#13:0x0000000188d1fc3c QuartzCore`CA::Transaction::commit()+528
帧#14:0x000000018966c838 UIKit`-[UIApplication\u reportMainSceneUpdateFinished:+60
帧#15:0x000000018966d71c UIKit`-[UIApplication\u与主场景一起运行:transitionContext:completion:+2804
帧#16:0x000000018966b778 UIKit`-[UIApplication WorkspaceDiEndTransaction:+184
帧#17:0x000000018d1a93c8 FrontBoardServices`u 31-[FBSSerialQueue performAsync:][U block_invoke_2+32
帧#18:0x000000018495827c CoreFoundation`\uuu CFRUNLOOP\u正在调用\u到\u块\uu20
帧#19:0x0000000184957384 CoreFoundation`\uu CFRunLoopDoBlocks+312
帧#20:0x00000001849559a8 CoreFoundation`u CFRunLoopRun+1756
帧#21:0x00000001848812d4 CoreFoundation`CFRunLoopRunSpecific+396
帧#22:0x000000018944c43c UIKit`-[UIApplication_run]+552
帧#23:0x0000000189446fac UIKit`UIApplicationMain+1488
*帧#24:0x0000000100046804 Ascii攻击'main+164 at AppDelegate.swift:11
帧#25:0x000000019684aa08 libdyld.dylib`start+4
(lldb)
但不幸的是,我不知道从这里走到哪里。我真的不知道如何破译回溯。我知道我的游戏场景类有问题,有没有办法弄清楚到底是什么?还是我必须单独测试每个属性
除此之外,当我没有在调试器中运行应用程序时,它在我的iPhone上运行良好
编辑:问题已解决。这显然是Xcode的一个bug,而不是我的任何代码 事实证明,这是一个带有xcode的bug,而不是任何代码,如本问题所示:
显然,EagleContext_renderBufferStorage可能会在iOS 8.3+上导致错误。解决方案是更改用于禁用GPU帧捕获的方案。不完全确定为什么会这样,但确实如此 我见过类似的事情发生在那些错误地将他们的资源包括在项目中的人身上。调试器可以访问不一定打包并发送到手机的文件。也许项目中没有正确包含精灵表?