简体   繁体   中英

Problems debugging swift project - can't print any variable to the console while paused (exc_bad_access)

For whatever reason my project has started giving me problems printing any variable when I set a breakpoint. Consider the following code:

if let index = hintTypesInUse.index(of: type) {
    let indexPath = IndexPath(item: 0, section: index + 1)
    hintTypesCollectionView?.reloadItems(at: [indexPath])
    hintTypesInUse[type].addHint()
}

If I set a breakpoint on the second line here, and I try to do 'po hintTypesInUse' I just get:

error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x1728c634e). The process has been returned to the state before expression evaluation.

Now hintTypesInUse is accessible in the code itself after this point, and this is just a random example, it goes for anything in this project. The only variables I seem to be able to access while debugging are local variables within that code block.

Tried looking through my build scheme to see if there was anything weird there, but it's set to debug mode, and I compared it with a blank new project and it looks identical to that.

Why can't I access any non-local variables while debugging?

And of course a restart of Xcode and a reboot was all it took to fix the problem. 😆

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM