I wrote a bug, and it’s on Firebase

Crashed: com.apple.main- Thread EXC_BREAKPOINT 0x00000001055a7a34Copy the code

There was no specific error, and because it was the navigation part, it was not easy to test, so I changed it according to the guess reason, and the result still crashed after the launch

Fatal Exception: NSInternalInconsistencyException Modifications to the layout engine must not be performed from a background thread after  it has been accessed from the main thread.Copy the code

Now, when did I refresh the UI on a child thread? That’s impossible. The tests are completely unrepeatable

But I added it anyway

DispatchQueue.main.async
Copy the code

Hope it doesn’t crash this time (I will come back to update the article after it hits the shelves)

This online crash, there are several Revelations: 1. There was no detailed prompt before, but when there was a detailed prompt later, I made a more complete package, so that each method is independent function, even Firebase can clearly find the cause of the error; 2, where the test is not possible, we must carry out as much protection as possible, even if the redundancy can not be wired bug; 3, some bugs, can be measured, more often, to review their own code to find detailed bugs.

Ps: Sure enough, it no longer crashes