HI, I have a Swift UI app in the mac appstore in the upcoming release we have made lots of changes and it is working fine in debug mode but in production with testflight or direct distribution we are getting the following crash while working in the app. this is happening in the rendering phase.
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libswiftCore.dylib 0x19546f270 swift_unknownObjectRetain + 44
1 libswiftCore.dylib 0x1954bb09c swift_cvw_initWithCopyImpl(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) + 280
2 libswiftCore.dylib 0x1958f685c initializeWithCopy for ClosedRange<>.Index + 212
3 VirtualProg 0x104d73958 <deduplicated_symbol> + 56
How can i debug to find out what is causing the issue and fix it?. thanks in advance
Modern versions of Apple’s linker are able to merge identical functions. That’s pretty darned cool, but it presents a problem for symbolication. Which symbol should it show?
By default it doesn’t show any of the symbols, but instead this <deduplicated_symbol> placeholder, which is exactly what you’re seeing here.
There are two ways around this:
- Disable the optimisation
- Manually symbolicate
By default, Xcode enables this optimisation only for Release builds. You can change that policy by the -no_deduplicate linker setting. See the ld man page for more about that.
IMPORTANT Put this linker flag in the Other Linker Flags build setting. Make sure to escape the value with -Xlinker.
The downside to this approach is that you miss out on a useful optimisation. To quantify that, pass the -verbose_deduplicate option to the linker and it’ll output a report of what it did.
An alternative is to manually symbolicate the frame’s address and then pass the -dedup option to atos. See the atos man page for more about that.
For more information about how to manually symbolicate, see Adding identifiable symbol names to a crash report.
The downside to this approach is that you still have to figure out which one of the duplicates caused the problem.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"