[英]SwiftUI causing EXC_BAD_ACCESS & stack trace with none of my calls in it
Just spend hours searching for a bug in my SwiftUI Code...只需花费数小时在我的 SwiftUI 代码中搜索错误...
All I got was an endless stack trace with none of my calls in it and EXC_BAD_ACCESS
at the end.我得到的只是一个无休止的堆栈跟踪,其中没有我的任何调用,最后是EXC_BAD_ACCESS
。
I had no clue what's going on.我不知道发生了什么事。
If this happens to you - first check if you have a " .
" in front of all your view modifiers!!如果这种情况发生在你身上——首先检查你是否有一个“ .
”在你所有的视图修饰符前面!!
It seems that in some cases it compiles without the " .
" and XCode shows correct syntax highlighting.似乎在某些情况下它编译时没有“ .
”和 XCode 显示正确的语法突出显示。 It took forever to spot it...花了很长时间才发现它...
In my case it was .onLongPressGesture
instead of onLongPressGesture
就我而言,它是.onLongPressGesture
而不是onLongPressGesture
I tried to figure out why this happens (it does not seem to happen in all of my views) - so if anyone could shine some light on this.. I'd appreciate to know!我试图弄清楚为什么会发生这种情况(在我的所有观点中似乎都没有发生) - 所以如果有人能对此有所了解......我很高兴知道!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.