kean / Pulse

Network logger for Apple platforms
https://pulselogger.com
MIT License
6.32k stars 302 forks source link

Pulse 4.0 crash when opening network task details #211

Closed ejensen closed 1 year ago

ejensen commented 1 year ago

When opening a network task details, the app crashes due to the ConsoleEnvironment not being assigned.

SwiftUI/EnvironmentObject.swift:82: Fatal error: No ObservableObject of type ConsoleEnvironment found. A View.environmentObject(_:) for ConsoleEnvironment may be missing as an ancestor of this view.

This can be reproduced in the Pulse iOS demo app:

https://github.com/kean/Pulse/assets/915431/2245864d-fb4d-41cb-8d90-45d839a3e388

kean commented 1 year ago

Thanks for the report, @ejensen. Fixed in 4.0.1.

The root cause is the incorrect use of environment objects. I was setting environment objects on ConsoleView and they are not propagated to the screens pushed from it. This was a last minute change, so it wasn't fully tested.