I've got this more symbolicated crash report hopefully it will help.
crash report.crash
Also here is the code for the GraphClient Init method that referenced in the crash log
init(storeDomain: String, additionalHeaders: [String: String], authorisationSource: APIAuthorizationSource) {
let baseHost: String
#if DEVSTORE
baseHost = "abc.com"
#else
baseHost = "efg.com"
#endif
let url = URL(string: "https://\(storeDomain).\(baseHost)/api/graphql")!
let store = ApolloStore(cache: InMemoryNormalizedCache())
let provider = NetworkInterceptorProvider(authorisationSource, store: store)
let nt = RequestChainNetworkTransport(interceptorProvider: provider,
endpointURL: url,
additionalHeaders: additionalHeaders)
apollo = ApolloClient(networkTransport: nt, store: store)
apollo.cacheKeyForObject = { [$0["__typename"], $0["id"]] }
}
My guess is that the problem is at line let url = URL(string: "https://\(storeDomain).\(baseHost)/api/graphql")! with string interpolation. I don't think the force unwrap for of URL here is the cause here but open for any suggestions.
Post
Replies
Boosts
Views
Activity
The GraphClient is created inside another class.
func createGraphClient() -> GraphClient {
return GraphClient(storeDomain: domain,
additionalHeaders: additionalHeaders,
authorisationSource: self)
}
The domain passed in here is a private(set) var domain: String
This variable is set on init based on some user input or after some API callback handler. But it won't be set to nil.
Have you found the root cause of it? I'm experiencing a similar issue but my crash happened on String interpolation. The top frames of the crash report also is from libswiftCore.dylib and to do with memory allocation.
This is the same issue as state here https://developer.apple.com/forums/thread/696197
Try update to Xcode 13.2RC it should solve your issue
Also this only happening on device. When running on simulator it is all fine
I've also set the navigationViewStyle to be StackNavigationViewStyle()
I've found a workaround which can prevent this crash from happening.
if #available(iOS 16.0, *) {
let keyWindow = UIApplication.shared.connectedScenes
.filter { $0.activationState == .foregroundActive }
.first(where: { $0 is UIWindowScene })
.flatMap { $0 as? UIWindowScene }?.windows
.first(where: \.isKeyWindow)
if let window = keyWindow {
window.rootViewController?.presentedViewController?.dismiss(animated: true)
}
}
Using UIKit to dismiss the model seem to work fine and won't trigger the crash. But this is not ideal and I don't know when this can get fixed.