You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MBLoggerCoreDataManager: fatalError in FileManager.storeURL crashes the host app when App Group container is unavailable on iOS Simulator first-launch — should throw and let bootstrap() degrade gracefully #705
When the host app's App Group entitlement is correctly configured but the container isn't yet mounted (clean iOS Simulator install after simctl uninstall / simctl install), FileManager.storeURL(for:databaseName:) calls fatalError which crashes the host process.
The bootstrap() method that ultimately consumes this URL is already wrapped in do/catch (MBLoggerCoreDataManager.swift:93-117) and would degrade storageState to .disabled if loadContainer threw — but fatalError short-circuits the catch and brings down the entire host app.
Reproduction
Host app with valid group.cloud.Mindbox.<bundle-id> entitlement (verified embedded via codesign -d --entitlements - Runner.app).
FileManager.storeURL(for:databaseName:) — FileManager+Extensions.swift:13
closure #1 in MBLoggerCoreDataManager.init — MBLoggerCoreDataManager.swift:18-23
MBLoggerCoreDataManager.bootstrap() — line 93
← Mindbox.assembly()
Mindbox.shared.unsafeMutableAddressor — first access of the lazy singleton
AppDelegate.initializeMindboxSdk() — our host code calling Mindbox.shared.initialization(configuration:)
Reproduces 100% on Xcode 26.x / iOS 26.5 Simulator with Mindbox and MindboxLogger both at 2.15.0.
Why this matters
Blocks automated UI testing on iOS Simulator (Maestro / XCUITest with clearState: true / simctl uninstall between runs).
Affects every first-launch on a CI runner that wipes the simulator between builds.
Related to Thread 1: Fatal error: containerURL not found for group: #124 (closed as a host misconfiguration) and Crash at MBLoggerCoreDataManager #585 (fixed a different fatalError in persistentContainer in 2.14.2). The pattern of using fatalError from within the SDK's init path is the deeper issue — an SDK should never bring down its host app just because one of its capabilities can't be initialized.
The host app's entitlement is correctly configured. The container is simply not yet available because the OS hasn't finished setting up the App Group sandbox on a brand-new install. Subsequent launches succeed (which is why this only shows up under automation, not under hand-driven QA).
Update callers (currently a single call site inside LoggerDatabaseLoader) to propagate the throws. MBLoggerCoreDataManager.bootstrap() already has a catch branch that sets storageState = .disabled and logs the failure — the new throw lands there cleanly. No behavior change in the happy path.
This keeps the original semantic guidance for misconfigured hosts (the host's logging is silently disabled and the developer sees an [MBLoggerCDManager] bootstrap failed: containerUnavailable(appGroup: ...) line in the console) while removing the crash.
If you want a louder signal for misconfigured hosts in DEBUG, an assertionFailure instead of fatalError would also keep the bootstrap path crash-free in release builds while still flagging the issue during development.
Environment
Mindbox 2.15.0
MindboxLogger 2.15.0
MindboxNotifications 2.15.0
mindbox_ios (Flutter plugin) 2.15.0
Xcode 26.x / iOS 26.5 Simulator (iPhone 17 Pro)
Host: Flutter 3.x app, native AppDelegate.swift calling Mindbox.shared.initialization(configuration:) from didFinishLaunchingWithOptions before GeneratedPluginRegistrant.register(with: self)
App Group: group.cloud.Mindbox.<bundle-id> (verified embedded in the .app's entitlements)
Happy to provide the full .ips crash log on request.
Summary
When the host app's App Group entitlement is correctly configured but the container isn't yet mounted (clean iOS Simulator install after
simctl uninstall/simctl install),FileManager.storeURL(for:databaseName:)callsfatalErrorwhich crashes the host process.The
bootstrap()method that ultimately consumes this URL is already wrapped indo/catch(MBLoggerCoreDataManager.swift:93-117) and would degradestorageStateto.disabledifloadContainerthrew — butfatalErrorshort-circuits thecatchand brings down the entire host app.Reproduction
group.cloud.Mindbox.<bundle-id>entitlement (verified embedded viacodesign -d --entitlements - Runner.app).EXC_BREAKPOINT (SIGTRAP).Stack trace from the .ips report:
Reproduces 100% on Xcode 26.x / iOS 26.5 Simulator with
MindboxandMindboxLoggerboth at2.15.0.Why this matters
clearState: true/simctl uninstallbetween runs).fatalErrorinpersistentContainerin 2.14.2). The pattern of usingfatalErrorfrom within the SDK's init path is the deeper issue — an SDK should never bring down its host app just because one of its capabilities can't be initialized.The host app's entitlement is correctly configured. The container is simply not yet available because the OS hasn't finished setting up the App Group sandbox on a brand-new install. Subsequent launches succeed (which is why this only shows up under automation, not under hand-driven QA).
Proposed fix
FileManager+Extensions.swift:Update callers (currently a single call site inside
LoggerDatabaseLoader) to propagate thethrows.MBLoggerCoreDataManager.bootstrap()already has acatchbranch that setsstorageState = .disabledand logs the failure — the new throw lands there cleanly. No behavior change in the happy path.This keeps the original semantic guidance for misconfigured hosts (the host's logging is silently disabled and the developer sees an
[MBLoggerCDManager] bootstrap failed: containerUnavailable(appGroup: ...)line in the console) while removing the crash.If you want a louder signal for misconfigured hosts in
DEBUG, anassertionFailureinstead offatalErrorwould also keep the bootstrap path crash-free in release builds while still flagging the issue during development.Environment
Mindbox2.15.0MindboxLogger2.15.0MindboxNotifications2.15.0mindbox_ios(Flutter plugin) 2.15.0AppDelegate.swiftcallingMindbox.shared.initialization(configuration:)fromdidFinishLaunchingWithOptionsbeforeGeneratedPluginRegistrant.register(with: self)group.cloud.Mindbox.<bundle-id>(verified embedded in the .app's entitlements)Happy to provide the full .ips crash log on request.