Closed samdeane closed 3 years ago
This is happening still in 11.4.
This caused the sil error
List {
if [.firstCall, .filterChanged].contains(offersService.loadingState) {
loadingList
} else {
Section {
ForEach(self.offersService.offers, content: LocationRow.init(viewModel:))
}
}
}
.introspectTableView(customize: { tableView in
tableView.separatorInset = UIEdgeInsets(top: 0, left: 100, bottom: 0, right: 0)
})
However simplifying the closure caused it to work.
List {
listItem
}
.introspectTableView(customize: { tableView in
tableView.separatorInset = UIEdgeInsets(top: 0, left: 100, bottom: 0, right: 0)
})
I got the same error in my case using introspectScrollView()
. Moving the entire contents of the ScrollView into a different variable fixed it.
@hipwelljo @iamtomcat @samdeane Thanks for reporting this issue! I'm happy to take a look if someone can provide a working example (view code or project). I couldn't reproduce locally on 11.4 with our test project.
If this is the same seg 11 that I'm getting, then it only happens with RELEASE builds, not DEBUG builds.
I need to do almost all of my builds as RELEASE, due to a need for testing on device (sim can't do what my app does) and also required compiler optimisations. So I'm running into this one a lot. At the moment I'm working around it by removing Introspect code from the problem views.
Unfortunately I don't have any more insights to offer yet - I haven't dug into the problem in any detail yet, I've merely worked around it for now.
Same problem here "Segmentation fault: 11" when archiving the app.
This happens on ViewModifier :
It also happens there :
But it doesn't happen there :
An ugly solution there on StackOverflow is to edit the "Enable testability" build option to "Yes" and it solves the problem for me. https://stackoverflow.com/questions/60865057/xcode-11-4-archiving-project-segmentation-fault-11
Same problem here when attempting a Release build. Segmentation fault: 11
The following code has the segmentation issue. Copy and paste into your ContentView.swift replacing existing code, try to profile or archive and the segmentation fault will occur (only happens on release builds)
import SwiftUI
import Introspect
struct DisplayRowView: View {
var body: some View {
Text( "test" )
}
}
struct ContentView: View {
var body: some View {
List {
ForEach( 0 ... 3000, id: \.self ) { i in
DisplayRowView()
}
}
.introspectTableView { tableView in
tableView.intercellSpacing = NSSize(width: 0, height: 0)
tableView.usesAlternatingRowBackgroundColors = true
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
commenting the .introspectTableView
solves the issue
UPDATE:
It has to be a compiler bug, putting the .introspectTableView
into a ViewModifier
solves the build issue
import SwiftUI
import Introspect
struct DisplayRowView: View {
var body: some View {
Text( "test" )
}
}
public struct IntroSpectTable: ViewModifier {
public func body(content: Content) -> some View {
content
.introspectTableView { tableView in
tableView.intercellSpacing = NSSize(width: 0, height: 0)
tableView.usesAlternatingRowBackgroundColors = true
}
}
public init() {}
}
struct ContentView: View {
var body: some View {
List {
ForEach( 0 ... 3000, id: \.self ) { i in
DisplayRowView()
}
.modifier( IntroSpectTable() )
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@samdeane, @gbrandt is this still happening?
We just tried to reproduce this and it's working fine for us. We've tried release builds and archiving on macOS using @gbrandt's example code.
@samdeane, @gbrandt is this still happening?
We just tried to reproduce this and it's working fine for us. We've tried release builds and archiving on macOS using @gbrandt's example code.
I haven't actually tried it for a while to be honest. At the time it was a blocker for me so I just stopped using SwiftUI-Introspect in that project, and I haven't needed it since.
@samdeane thanks for the reply, we'll close the issue for now.
Maybe you can give Introspect another chance 😉 Feel free to open another issue if you experience this or any other bug in the future.
This is really just FYI, since it's likely to be a compiler bug.
When I use Introspect in one of my views, I'm getting a segmentation fault when I build in release, using Xcode 11.4b2.
Removing the use of
.introspectTextField
is enough to fix it.Stack trace included below. Note that the output is a little confusing, and at first glance looks like it's related to the warning near the top. I don't think that's the case.