|
I am writing my first SwiftUI app, a form to collect information. A bunch of input, create a JSON file, upload to server. Two of my TestFlight users sent in crash reports on one Picker element, the error was what looks like array out of bounds. The code looks like:
The crash report is pointing to the ForEach loop. This is intermittent, most of the time the list generated has no problems. Am I using the ForEach wrong when using to generate the Picker list?
|
|
Not sure what the full intent is, but based on your code, I built out simple view that seems to work. For your code, what is the purpose of the showGuidance05 Bool?
|
|
Yes, mine also works, about 90% of the time...
It displays a string for the user to understand the purpose of the question (exerpt fro the manual ;) when they long press the (i):
I was able to reporduce the error, and received the following from Xcode: The Xcode marker is on the
Looks like I may need to supply an |
|
Did you try:
This should avoid the use of index and might help avoid the problem altogether. |
|
I've added id: and have not been able to cause a crash running it 30 times. Code now looks like:
I needed the index, as that is what I need to send up stream in the JSON data. Thank you for all your help - we'll see if the testers can cause this (and the other 8 Pickers that use this scheme) index out of bounds crash again, or if this |
|
Have you found the solution? I have the same issue even with the
|
SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.