Short story: My SwiftUI app (let's say the name is *MyApplic*) is working on hundred of Apple devices (iPhone and iPad) like a charm. But at least 3 persons are concerned by a mysterious crash when they made the same action (navigate to an other view). Obviously, I can't reproduce this crash on devices I have... And of course, different devices and iOS versions. For example an iPhone X with iOS14.4, I have one and no problem on mine...
Here is the stack trace for error: *EXCBADACCESS KERNINVALIDADDRESS*
Crash stack - https://developer.apple.com/forums/content/attachment/c3e590ff-9895-48a1-b6a6-a40c659eb398
So, trying my best te fix it, I met a person who have to crash, and try to analyze it. Reproduce it with *NSZombiEnabled* gives me this information:
[SwiftUI.AccessibilityNode retain]: message sent to deallocated instance 0x282146760
As it is on a physical device, I can't do many more with instruments, etc... But with *lldb* command line, I tried to know the malloc stack of the implied object. With the following command,
(lldb) malloc_info --stack-history --max-frames=256 0x282146760
I have:
Malloc history - https://developer.apple.com/forums/content/attachment/f88a0708-c03d-4d8b-8843-5cf69fcadd39
Please, could you give me some directions or indications? Is it a SwiftUI issue? Why do it happens on these devices in particular?
Post
Replies
Boosts
Views
Activity
This question is inspired by this stackoverflow post :
https://stackoverflow.com/questions/59895935/swiftui-form-and-stacknavigationviewstyle-run-berserk
At present (Xcode 11.7) there seems to be a bug in Form, making a new copy of the view with every orientation change of the device. I can reproduce it on a iPhone 11 emulator with iOS 13.7.
Sample code:
import SwiftUI
struct ContentView: View {
		var body: some View {
						Form{
								Text("Text")
						}
		}
}
Visual debugger at beginning, rotate left and then rotate right, shows an additional view added to the view stack with each new movement.
A Form automatically adopts the GroupedListStyle and it seems that it’s actually there the bug is. Because a List with GroupedListStyle shows the same behavior in the visual debugger.
import SwiftUI
struct ContentView: View {
		var body: some View {
				List{
						Text("Text")
				}.listStyle(GroupedListStyle())
		}
}
So, any workaround or fix informations please?