App crashes on @main

I'm using AWS Amplify for my user Auth, right after user logging the app crashes on @main without any log error...

This is the red crash message that appears on the screen: Thread 1: EXC_BAD_ACCESS (code=1, address=0x31df7547340)

I've tried to debug it commenting out parts of the app but I can't find where is the problem because it happens randomly. I can log 4 times in a row fine and the 5th crashes or 2 times in a row it crashes, it's random.

How can I properly debug this error?

Add a Comment

Replies

It’s likely that the crash occurred deep in some library code and Xcode is showing you the first frame in the backtrace for which it has source code. That doesn’t give you any insight into what’s causing the crash.

If you run your app from outside Xcode — from the Home screen if it’s an iOS app, from the Finder if it’s a Mac app, and so on — does it still crash? If so, that should generate a crash report. Grab that and post it here.

See Posting a Crash Report for advice on how to post your crash report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Hi, please see my answer below with the attached log

  • I added another one called Main Crash 1

Add a Comment

Hi, yes. It crashes while in testflight, released version, and xcode simulator. I still cannot find what's causing it :/ but I know how to reproduce it. It's after I click login when signing in. I refactored the whole function and it's working fine, but the error is there... Here's the crash log generated, It would mean a lot if you could help me find what's the issue, this random crash is driving me crazy..

For what I see there it says Segmentation fault but coming from where? Who's causing it?

coming from where?

Your second example shows that clearly:

0  SwiftUI … _OUTLINED_FUNCTION_66 + 16
1  SwiftUI … $s7SwiftUI4TextV7resolve4into2in4withyxz_AA17EnvironmentValuesVAC14ResolveOptionsVtAA08ResolvedC9C…
2  SwiftUI … $s7SwiftUI19UIHostingControllerC12promoteTitle2inyAA17EnvironmentValuesV_tFAA19_ConditionalContent…
3  SwiftUI … partial apply for specialized closure #1 in UINavigationController.updateRootHost<A>(root:environm…
4  SwiftUI … CustomGraphMutation.apply() + 28 (GraphHost.swift:696)
5  SwiftUI … AsyncTransaction.apply() + 192 (GraphHost.swift:727)
6  SwiftUI … GraphHost.flushTransactions() + 288 (GraphHost.swift:517)
7  SwiftUI … specialized closure #2 in UINavigationController.updateRootHost<A>(root:environment:transaction:) …
8  SwiftUI … thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:0)
9  SwiftUI … static Update.end() + 600 (<compiler-generated>:0)
10 SwiftUI … static NSRunLoop.flushObservers() + 172 (StandardLibraryAdditions.swift:832)
11 SwiftUI … closure #1 in closure #1 in static NSRunLoop.addObserver(_:) + 16 (StandardLibraryAdditions.swift:…

I looks like this code is running as a run loop observer installed by SwiftUI (frame 16). It’s in the process of flushing transactions to the view hierarchy (frame 6) and something in that code has crashed by accessing bad memory.

Unfortunately I don’t know enough about SwiftUI’s internals to offer insight beyond that. If no one else chimes in, I recommend that you open a DTS tech support incident and talk to one of our SwiftUI experts.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I'll wait to see if someone can help if not open the ticket, thank you

Add a Comment

he @afern247 how did you resolve this matter? I have the same problem.

I also have the same problem. Has any solution been found?