PageTabViewStyle is causing a crash amongst a significant portion of my users and I've been unable to reproduce this issue.
I've first written about this in this post from 4 months ago, after which I've reached out to DTS. Since then I've been able to narrow down the cause to PageTabViewStyle, with the logs suggesting its a SwiftUI framework issue.
DTS at the time had no clue and instructed me to file a bug report (FB8984414), but I haven't heard anything about it. Latest reply from DTS a while ago was that they have no information on the matter.
So ever since I've removed PageTabViewStyle (in part because it was used in onboarding) and avoided using it.
Now with the extra activity here by engineers during dub-dub I was hoping I could get some answers.
I've scheduled labs to ask about it, but figured I might be able to save everyone some time and open up the slot to others, should I be able to get an answer on this.
The two burning questions would be:
- Is/was this a bug, if so is it resolved?
- If not, how to prevent the SIGABRT
Text of the bug report below:
A whole bunch of my users are experiencing consistent crashes after I’ve implemented scrolling pages by adding the .tabViewStyle(PageTabViewStyle()) modified to a TabView.
Despite them reporting a 100% crash rate whenever they try to bring up the View that has the offending TabView, I am unable to reproduce this issue myself, making it impossible for me to provide useful steps to reproduce the issue or to provide a minimal working example. Instead I will be providing Swift files that contain the offending code.
The crash logs that I have received, and included with this bug report, don’t indicate clearly what the cause of the SIGABRT is, but based on information provided by users I started suspecting the issue lied with the specific TabViewStyle. I verified this suspicion by commenting out the TabView code and have a handful of users that reported consistent issues test out this new build on TestFlight. The results were 0 crashes, further confirming my suspicions. I will also include the Swift files of this build.
After this I reached out to Developer Technical Support and they instructed me to file this bug report.
@Stammy I had forgotten to update this post in reaction to a labs sessions at WWDC.
The issue I was describing (and that's more detailed in the thread I linked to) was apparently a VoiceOver bug that was causing the SIGABRT crash.
I was told this should've been fixed in iOS 15, but like you I'm stumbling upon this access issue, causing the app to be terminated.
Additionally they've offered some code for a quick workaround, I'll copy paste the code at the bottom.
I haven't tested it on XC 13 beta 2 and iOS 15 beta 2 yet, but I think it might be best to file a new bug report for this, since this seems to be a different issue. I'll be doing the same if the issue persists with the new betas and I'll probably mention the FB number of the previous issue, just in case it is related.
It might be a good idea to share FB number here if you file one yourself. Referring to FB numbers of similar reports tends to be helpful.
struct ContentView: View {
@State private var presenting = false
@State private var currentPage = 1
var body: some View {
Button("Tap to show page control") {
presenting = true
}
.sheet(isPresented: $presenting, content: {
ChildView {
PageControl(pageCount: 5, currentPage: $currentPage)
.background(Color.blue)
}
})
}
struct ChildView<Content: View>: View {
@ViewBuilder var content: Content
@State private var isVisible = false
@Environment(\.accessibilityEnabled) var accessibilityEnabled
var body: some View {
content
.environment(\.accessibilityEnabled, accessibilityEnabled && isVisible)
.onAppear {
isVisible = true
}
}
}
}