Socialcademy 2: Displaying posts -> App crash!

Hello there!

I am really stuck with this project and seems that a very simple line is making the app crash.

When creating the post search bar, the variable to store the text to search, at line 12:

@State private var searchText = ""

makes the app crash, getting the following error:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

I’ve been a couple of days trying to figure out the problem with no luck. Any help?


Managed to find and fix the issue!

First, the app wouldn’t crash if you comment on the SocialcademyApp swift file the following line:


That lead me to think that the problem had to be with the Firebase configs.

Not really but close…

While working with Firebase, the system uses different threads that if they are not managed in the right way the app will crash.

So in the viewModel (it will be created in the following tutorial “Socialcademy 3: Uploading Data to Firebase”), when you declare it as


the issue is sorted! :tada::tada::tada:

Wrapping up, I would say that this was a good learning experience that gave me the opportunity to research a bit by myself. But I would also suggest to the Codecademy team to double check the tutorials as if you follow them step by step, sometimes you find issues like this that eventually will fix themselves in further tutorials. But in the meantime can be very frustrating for the learners.

Thanks for reading and have a good coding day!