Last weekend, I’ve updated Xcode to 12.2 and I’ve encountered a strange bug. I was receiving the error “EXC_BAD_ACCESS (code=257, …” in place I didn’t expect that.
The problem was strange because it didn’t exist on Debug build, it was only on Release one.
Enabling Zombies didn’t tell me anything, so I was looking for another tip on what is wrong.
Finally, I’ve encountered this article https://developer.apple.com/forums/thread/68829. It was in a different place than mine but case.
I turned off Optimization and the error stops occurring. It looks the problem is in the new Xcode but I’m not sure for 100%, it’s only my guess but optimization help.
How To Turn Off Optimization
In Project Setting -> Build Setting -> Search for Swift Compiler. By default, Debug doesn’t have any Optimization but Release has.