SwiftUI: No ObservableObject of type X found iOS Origin: On your device OSI layer 7 · Application Last updated 25 Nov 2026

Fatal error: No ObservableObject of type SessionStore found. A View.environmentObject(_:) for SessionStore may be missing as an ancestor of this view.

A view reads an @EnvironmentObject that no parent provided.

Exact message you may see No ObservableObject of type foundA View.environmentObject(_:) may be missing as an ancestorenvironmentObject missingFatal error: No ObservableObject of type SessionStore found. A View.environmentObject(_:) for SessionStore may be missing as an ancestor of this view.
Seen on: iOS Swift SwiftUI

Meaning

Add .environmentObject(store) to an ancestor (including sheets and previews, which don't inherit in some cases).

Common causes

  • Missing .environmentObject
  • Presented sheet/popover without it
  • Preview without injecting

⚡ Quick fix

  1. Inject at the root and in sheets
  2. Add it to previews
  3. Use @Environment with Observation instead

Detailed fix by platform

Swift

  1. ContentView().environmentObject(SessionStore())

How to diagnose

  1. Root — injects?
  2. Sheet — injects?
  3. Preview — injects?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

@Observable requires iOS 17 — error: 'Observable()' is only available in iOS 17.0 or newer (iOS)@Observable requires …@ObservedObject recreated on every view update (use @StateObject) — (behavior) ViewModel resets when parent re-renders (iOS)@ObservedObject recre…An instance was deallocated while key value observers were still registered — NSInternalInconsistencyException: An instance 0x7f of class Foo was deallocated while key value observers were still registered with it (iOS)An instance was deall…App Review Guideline 2.1: App Completeness — Guideline 2.1 - Performance - App Completeness: We discovered one or more bugs in your app (iOS)App Review Guideline …AVAudioEngine: required condition is false: format.sampleRate == hwFormat.sampleRate — Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate' (iOS)AVAudioEngine: requir…Cannot preview in this file — SwiftUI Preview: Cannot preview in this file — the preview crashed / failed to build (iOS)Cannot preview in thi…Core Data: NSManagedObjectContext was accessed from the wrong queue — CoreData: error: Serious application error. Exception was caught during Core Data change processing (iOS)Core Data: NSManagedO…Crash report not symbolicated (missing dSYM) — Crashlytics: Missing dSYM — upload dSYMs to see readable stack traces (iOS)Crash report not symb…SwiftUI: …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.