SwiftUI Crash iOS 17 (CoreTransferable)

Hello! We have an app built in SwiftUI in which only users with iOS 17 are experiencing crashes that occur randomly when a user accesses a module in which we use the ShareLink component which we suspect is part of the problem.

I'd really appreciate if anybody can point me to a direction to debug this crash. Please also let me know if you experience the same crash.

Accepted Answer

I'm experiencing the same problem. For now I'm able to work around it by delaying the presentation of the sharelink. Something like this:

struct ContentView: View {
    @State var showShareLink = false
    
    var body: some View {
        
        HStack {
            if showShareLink {
                ShareLink()
            } else {
                Image(systemName: "square.and.arrow.up")
                Text("Export")
            }
        }
        .onAppear() {
            Timer.scheduledTimer(withTimeInterval: 1, repeats: false) { _ in
                self.showShareLink = true
            }
        }
    }
}

For me, the problem turned out to be in my own code. I was calling something inside

public static var transferRepresentation: some TransferRepresentation {

After I moved that code into

DataRepresentation(exportedContentType: .pdf, exporting: { ... }

the problem went away.

SwiftUI Crash iOS 17 (CoreTransferable)
 
 
Q