ios EXC_BAD_ACCESS (code=1, address=0x0) 单步调试器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19582957/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:34:10  来源:igfitidea点击:

EXC_BAD_ACCESS (code=1, address=0x0) when stepping in debugger

iosxcodedebuggingxcode5osx-mavericks

提问by Bobrovsky

My application crashes each and every time I try to step over a call. Without debugger it works fine.

每次我尝试跳过呼叫时,我的应用程序都会崩溃。没有调试器它工作正常。

Also, when I run the app in simulator it woks fine with or without debugger.

此外,当我在模拟器中运行该应用程序时,无论是否使用调试器,它都可以正常工作。

Recently I upgraded my Mac OS X 10.8 to 10.9 (Mavericks). There were no issues before the upgrade.

最近我将 Mac OS X 10.8 升级到 10.9(小牛队)。升级前没有问题。

What causes the issue and how could I fix it?

是什么导致了这个问题,我该如何解决?

Below is the back trace. My app uses ARC. I have enabled zombies and added exception breakpoint but no zombies where detected and exception breakpoint is never triggered.

下面是回溯。我的应用程序使用 ARC。我启用了僵尸并添加了异常断点,但没有检测到僵尸并且从未触发异常断点。

    * thread #1: tid = 0x2503, 0x00000000, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame #0: 0x00000000
        frame #1: 0x35e170c4 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 72
        frame #2: 0x35e17076 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
        frame #3: 0x35e17054 UIKit`-[UIControl sendAction:to:forEvent:] + 44
        frame #4: 0x35e1690a UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 502
        frame #5: 0x35e16e00 UIKit`-[UIControl touchesEnded:withEvent:] + 488
        frame #6: 0x35d3f5f0 UIKit`-[UIWindow _sendTouchesForEvent:] + 524
        frame #7: 0x35d2c800 UIKit`-[UIApplication sendEvent:] + 380
        frame #8: 0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
        frame #9: 0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
        frame #10: 0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
        frame #11: 0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
        frame #12: 0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
        frame #13: 0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
        frame #14: 0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
        frame #15: 0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
        frame #16: 0x37a1d2ea GraphicsServices`GSEventRunModal + 74
        frame #17: 0x35d80300 UIKit`UIApplicationMain + 1120
        frame #18: 0x000faac8 MyApp`main(argc=1, argv=0x2fd0fd08) + 116 at main.m:16

EDIT:

编辑:

I have latest Xcode Version 5.0.1 (5A2053).

我有最新的 Xcode 版本 5.0.1 (5A2053)。

I have created new app from scratch and ran it without issues. Then I put a breakpoint in ViewController's viewDidLoadand tried to step over. Here I got another crash

我从头开始创建了新的应用程序并且运行它没有问题。然后我在ViewController's 中放置了一个断点viewDidLoad并试图跨过。在这里我又崩溃了

* thread #1: tid = 0x2503, 0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x4)
    frame #0: 0x3bb9d7c4 libobjc.A.dylib`objc_msgSendSuper2 + 4
    frame #1: 0x000b913a test`-[ViewController viewDidLoad](self=0x1cda5c70, _cmd=0x361bd5db) + 62 at ViewController.m:19
    frame #2: 0x35d4b594 UIKit`-[UIViewController loadViewIfRequired] + 364
    frame #3: 0x35d8bd78 UIKit`-[UIWindow addRootViewControllerViewIfPossible] + 64
    frame #4: 0x35d87aec UIKit`-[UIWindow _setHidden:forced:] + 364
    frame #5: 0x35dc91e8 UIKit`-[UIWindow makeKeyAndVisible] + 60
    frame #6: 0x35d8c83e UIKit`-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1666
    frame #7: 0x35d8484a UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 698
    frame #8: 0x35d2cc38 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1004
    frame #9: 0x35d2c6cc UIKit`-[UIApplication sendEvent:] + 72
    frame #10: 0x35d2c11a UIKit`_UIApplicationHandleEvent + 6154
    frame #11: 0x37a1e5a2 GraphicsServices`_PurpleEventCallback + 590
    frame #12: 0x37a1e1d2 GraphicsServices`PurpleEventCallback + 34
    frame #13: 0x33ef9172 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
    frame #14: 0x33ef9116 CoreFoundation`__CFRunLoopDoSource1 + 138
    frame #15: 0x33ef7f98 CoreFoundation`__CFRunLoopRun + 1384
    frame #16: 0x33e6aebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #17: 0x33e6ad48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #18: 0x35d83484 UIKit`-[UIApplication _run] + 668
    frame #19: 0x35d80300 UIKit`UIApplicationMain + 1120
    frame #20: 0x000b93bc test`main(argc=1, argv=0x2fd51d30) + 116 at main.m:16
    frame #21: 0x3bfd9b20 libdyld.dylib`start + 4

EDIT 2:

编辑2:

Greg Clayton in the XCode 5 Crashes while running the app on devicesuggests following

在设备上运行应用程序时 XCode 5 Crashes中的 Greg Clayton建议遵循

Others have seen this issue.
A few things to try:
1 - Reboot your device and try again. The theory is an old developer disk image is already mounted and won't be unmounted until you reboot.
2 - Re-install the OS on the device

Hopefully #1 fixes your issue. Others have done #2 and had their issue fixed, but hopefully it doesn't require an OS re-install.

I did both and it didn't help.

我做了两个,但没有帮助。

I tried to use another device and it made a difference. Exceptions are still there if I use iPod Touch with iOS 6.1 but iPad with iOS 7.0.2 works fine.

我尝试使用其他设备,结果有所不同。如果我在 iOS 6.1 上使用 iPod Touch,但在 iOS 7.0.2 上使用 iPad 时,例外仍然存在。

So, it looks like the issue is related to the iOS version installed on the device. I am still not sure what to do to fix it.

因此,问题似乎与设备上安装的 iOS 版本有关。我仍然不确定该怎么做才能解决它。

EDIT 3:

编辑 3:

My Command Line Tools version matches my Xcode version (I have only one version of Command Line Tools, actually).

我的命令行工具版本与我的 Xcode 版本匹配(实际上我只有一个命令行工具版本)。

The issues is probably not related to the code being debugged. It crashes with newly created Single View Application created by Xcode. And it crashes when stepping over trivial code:

这些问题可能与正在调试的代码无关。它会因 Xcode 创建的新创建的单一视图应用程序而崩溃。它在跳过琐碎的代码时崩溃:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

I have askedon Apple Developer Forum and got following response from Jason Molenda:

我在 Apple Developer Forum 上问过,并得到了 Jason Molenda 的以下回复:

We're tracking a bug that sounds like what you're seeing here. It is a subtle timing issue that requires a slightly slower host machine or a slightly slower device to hit. It is primarily iPhone 4 and similar that will see this with iOS 7. With iOS 6, iPhone 4 and iPhone 3GS devices are most likely to experience it. ... This issue will only happen with Xcode 5.0.1.

我们正在跟踪一个听起来像您在这里看到的错误。这是一个微妙的计时问题,需要稍慢的主机或稍慢的设备才能命中。主要是 iPhone 4 和类似的设备会在 iOS 7 中看到这一点。使用 iOS 6、iPhone 4 和 iPhone 3GS 设备最有可能体验到它。... 这个问题只会发生在 Xcode 5.0.1 上。

So, it seems like it's a bug in Xcode.

所以,这似乎是 Xcode 中的一个错误。

采纳答案by Bobrovsky

Ok, this is definitely a bug in Xcode 5.0.1.

好的,这绝对是 Xcode 5.0.1 中的一个错误。

This is confirmed by Jason Molenda on Apple Developer Forum. The only workaround for now is to use older version of Xcodeand the older version of Mac OS X because Xcode 5 requires OS X 10.8.4.

Jason Molenda在 Apple Developer Forum 上证实了这一点。目前唯一的解决方法是使用旧版本的 Xcode和旧版本的 Mac OS X,因为 Xcode 5 需要 OS X 10.8.4。

There is no announced ETA for a fix for this issue. Direct question about ETA on Apple Developer Forum is left without answer.

没有针对此问题的修复宣布 ETA。苹果开发者论坛上关于 ETA 的直接问题没有答案。

UPDATE 06-Nov-2013:

2013 年 11 月 6 日更新:

Today a pre-release version of Xcode 5.0.2 became available on developer.apple.com. This version fixes (among other things) the following issue:

今天 Xcode 5.0.2 的预发布版本在developer.apple.com 上可用。此版本修复了(除其他外)以下问题:

Debugging an application on a device running iOS 6.x causes the application to crash with EXC_BAD_ACCESS. ?This has been resolved. (15310896)

在运行 iOS 6.x 的设备上调试应用程序会导致应用程序因 EXC_BAD_ACCESS 崩溃。?这已经解决了。(15310896)

I have installed the new version and the issue is indeed gone. Now I am able to debug apps on my 6.x devices again.

我已经安装了新版本,问题确实消失了。现在我可以再次调试 6.x 设备上的应用程序。

Jason Molenda in thread on Apple Developer Forumsaid:

Jason Molenda 在Apple Developer Forum 的帖子中说:

I'm told you can submit apps to the app store with this Xcode 5.0.2 seed.

我听说您可以使用此 Xcode 5.0.2 种子将应用程序提交到应用程序商店。

回答by Max

I confirm I have exactly same bug. My App worked fine. After upgrade to Xcode 5 and Mavericks code work but when I debug I can't Step Over certain lines as I get EXC_BAD_ACCESS.

我确认我有完全相同的错误。我的应用程序运行良好。升级到 Xcode 5 和 Mavericks 代码工作后,但当我调试时,我无法跳过某些行,因为我得到 EXC_BAD_ACCESS。

So I have to remember lines that I can't pass with Step Over and put break point after these lines or use Continue to Line to jump over these problematic lines.

所以我必须记住我不能通过 Step Over 的行并在这些行之后放置断点或使用 Continue to Line 跳过这些有问题的行。

PS

聚苯乙烯

Downloaded Xcode 5.0.2 GM seedand debugging is much better. I spent 30 minutes with new Xcode so far.

下载Xcode 5.0.2 GM seed和调试好了很多。到目前为止,我花了 30 分钟使用新的 Xcode。

回答by Vincent Sit

Please login developer site and download the Xcode 5.0.2 GM seed, it fixed this bug.
See the release notes.

请登录开发者站点并下载Xcode 5.0.2 GM 种子,它修复了此错误。
请参阅发行说明

Update 12-Nov-2013
Xcode 5.0.2 has released, you can download it from Dev Center

2013 年 11 月 12 日更新
Xcode 5.0.2 已发布,您可以从Dev Center下载