Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

swift - Why am I getting the error "EXC_BAD_ACCESS"

I am trying to debug my Autolayout using the suggestions of this website, to highlight views that are causing constraint issues. However when I try to change the color of the suspect view with the command

expr ((UIView *)0x7f9ea3d43410).backgroundColor = [UIColor redColor]

I get the Error

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

I have also gotten the error:

error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.
The process has been returned to the state before expression evaluation.

I am not sure why I am getting this error as I have made sure to replace the example hex code with my own, what does this error even mean?

I am coding in swift, the website I reference uses objective-c, that may be my problem. what would the swift code be to do the same thing? I have tried:

expr ((UIView *)0x7f9ea3d43410).backgroundColor = UIColor.redColor
question from:https://stackoverflow.com/questions/65908897/why-am-i-getting-the-error-exc-bad-access

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think the short answer is "that link is from 2015 and the recommended technique uses hidden internal symbols that are no longer supported."

Specifically, the symbol is _autoLayoutTrace. That is a private symbol which apparently has been dropped.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...