Weird crash on iOS 15 #986
-
I'm seeing this crash when running on a device with iOS 15. It seems more like a bug with the code generated by the compiler, but I haven't been able to find much info on the Internet. Has anyone encountered this? Any workaround? I have tried to disable bitcode, optimizations, but it crashes anyway. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
In my experience, these weird crashes (that are happening where they shouldn't) are caused by a stack overflow. It can happen easily when using TCA, as the State can end up being a huge struct value that lives almost entirely on the stack. It may be something else, but that's what I'd try first in this case. Deleting DerivedData may also be an option if you have doubts about your compiler-generated code. |
Beta Was this translation helpful? Give feedback.
-
I usually see this when changing the state object in module/package between runs. Quick 'Clean Build Folder' resolves it. I would blame Xcode. May be related to the new experimental build system in Xcode 13.2. Working with smaller feature modules helps to reduce recompiling needed. |
Beta Was this translation helpful? Give feedback.
-
Thanks all. Yes, I saw that there was a view store inspecting the whole app state, and optimized that away. I got rid of some code and this crash went away. Probably it's due to a stack overflow, as @tgrapperon suggested; I discarded it initially because the stack didn't seem that large to me, but it might be related. |
Beta Was this translation helpful? Give feedback.
In my experience, these weird crashes (that are happening where they shouldn't) are caused by a stack overflow. It can happen easily when using TCA, as the State can end up being a huge struct value that lives almost entirely on the stack.
Maybe you can try to box a few of your child states (you can convert them as a computed property to the first value of a one-value array (which stores its values on the heap) to quickly check if it helps, or use a proper boxing property wrapper). You may find more information here and here for example.
It may be something else, but that's what I'd try first in this case. Deleting DerivedData may also be an option if you have doubts about your compiler-g…