firebase-ios-sdk
firebase-ios-sdk copied to clipboard
SwiftUI preview canvas crashes with manual Firebase framework install
Description
When Firebase is installed manually from zip file, includes both FirebaseAnalytics
and FirebasePerformance
, and then any SwiftUI file is opened with the canvas. I expected the SwiftUI view shows in preview mode. Instead the SwiftUI view briefly displays and then is replaced by the red 'x' and "Preview Crashed" message. Xcode then shows an "[app] quit unexpectedly" dialog with the option to reopen, report to Apple, or ignore.
This happens every time the canvas reloads and makes using Firebase with a manual install (which would save 30 seconds at least on build times and make many processes much faster) impossible.
This issue is essentially the same as #8005 but does not appear to be resolved with the Promises
2.3.1 distribution. I did check that FBLPromises
and PromisesSwift
in the 10.14.0 zip file are both on 2.3.1 but the error is still happening.
I was also chatting with @ncooke3 in #11104 about this issue as having a stable SPM binary distro would make manual zip install unnecessary.
Created with minimal reproducible example.
Crash view:
Quit dialog:
Sample crash log file: Firebase Canvas Crash Log.txt
Reproducing the issue
- Open Xcode and create a new iOS app.
- Register app with Firebase and download plist file with configuration.
- Add all of the Frameworks required by
FirebaseAnalytics
andFirebasePerformance
. Note this issue does not happen which justFirebaseAnalytics
installed (see screenshot)
- Add minimal code to the main app file to initialize Firebase (
import Firebase
andFirebaseApp.configure()
in theinit()
). UseUIApplicationDelegate
orinit()
makes no difference. - Enable the canvas preview on the right side of the screen.
EXPECTED: SwiftUI view shows in preview mode ACTUAL: SwiftUI view briefly displays and then is replaced by the red 'x' and "Preview Crashed" message. Xcode then shows an "[app] quit unexpectedly" dialog with the option to reopen, report to Apple, or ignore.
Firebase SDK Version
10.14.0
Xcode Version
14.3.1
Installation Method
Zip
Firebase Product(s)
Analytics, Crashlytics, Performance, Remote Config
Targeted Platforms
iOS
Relevant Log Output
Incident Identifier: 4AC2E45D-A639-4043-8CC4-8A3DEB1F177B
CrashReporter Key: 1584B102-F656-58D7-0802-42A749623D01
Hardware Model: MacBookPro18,2
Process: FirebaseBugTest [31737]
Path: /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/5B01915D-CE11-462B-BF74-065F72D93C43/data/Containers/Bundle/Application/6D4EABE8-C869-4768-8C1F-EE4F060656D4/FirebaseBugTest.app/FirebaseBugTest
Identifier: com.redacted.FirebaseBugTest
Version: 1.0 (1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd_sim [31328]
Coalition: com.apple.CoreSimulator.SimDevice.5B01915D-CE11-462B-BF74-065F72D93C43 [7070]
Responsible Process: SimulatorTrampoline [18760]
Date/Time: 2023-08-28 11:08:44.1036 -0400
Launch Time: 2023-08-28 11:08:43.7343 -0400
OS Version: macOS 13.5.1 (22G90)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: FirebaseBugTest [31737]
Triggered by Thread: 3
Last Exception Backtrace:
0 CoreFoundation 0x180437324 __exceptionPreprocess + 160
1 libobjc.A.dylib 0x180051274 objc_exception_throw + 56
2 CoreFoundation 0x180445e3c +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x18043b224 ___forwarding___ + 1308
4 CoreFoundation 0x18043d50c _CF_forwarding_prep_0 + 92
5 FirebaseBugTest 0x102ae2448 -[GDTCCTUploadOperation updateNextUploadTimeWithResponse:forTarget:] + 52
6 FirebaseBugTest 0x102ae1bd0 __54-[GDTCCTUploadOperation uploadBatch:toTarget:storage:]_block_invoke + 56
7 FirebaseBugTest 0x102af3b80 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.18 + 52
8 libdispatch.dylib 0x180132ee4 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x180134708 _dispatch_client_callout + 16
10 libdispatch.dylib 0x18013c95c _dispatch_lane_serial_drain + 1256
11 libdispatch.dylib 0x18013d3dc _dispatch_lane_invoke + 392
12 libdispatch.dylib 0x180149608 _dispatch_workloop_worker_thread + 768
13 libsystem_pthread.dylib 0x1b1834878 _pthread_wqthread + 284
14 libsystem_pthread.dylib 0x1b183363c start_wqthread + 8
Kernel Triage:
VM - (arg = 0x0) pmap_enter retried due to resource shortage
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x1b17dc1d0 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1b17ed298 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x1b17e43d8 mach_msg_overwrite + 540
3 libsystem_kernel.dylib 0x1b17dc540 mach_msg + 20
4 CoreFoundation 0x18039a4a8 __CFRunLoopServiceMachPort + 156
5 CoreFoundation 0x180394ad4 __CFRunLoopRun + 1128
6 CoreFoundation 0x180394254 CFRunLoopRunSpecific + 584
7 GraphicsServices 0x188eb7c9c GSEventRunModal + 160
8 UIKitCore 0x104ddaff0 -[UIApplication _run] + 868
9 UIKitCore 0x104ddef3c UIApplicationMain + 124
10 SwiftUI 0x10875734c 0x107800000 + 16085836
11 SwiftUI 0x1087571ec 0x107800000 + 16085484
12 SwiftUI 0x107f4f474 0x107800000 + 7664756
13 FirebaseBugTest 0x102adc430 static FirebaseBugTestApp.$main() + 40 (FirebaseBugTestApp.swift:11)
14 FirebaseBugTest 0x102adc4d8 main + 12
15 dyld_sim 0x102f39514 start_sim + 20
16 dyld 0x102fedf28 start + 2236
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved
snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock
snippet
Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Thanks @mthormann-dhi, instead of configuring Firebase in the app's init
, could you try implementing a UIApplicationDelegateAdaptor
(https://developer.apple.com/documentation/swiftui/uiapplicationdelegateadaptor), and then calling FirebaseApp.configure()
within your delegate's applicationDidFinishLaunching
API?
I've switched over to using app delegate for Firebase initialization. Most of the time, I'm still seeing it fail with the same error. Every now and then I do very occasionally get in this state where the canvas is working somehow. But if I close Xcode, and just re-open the app and re-enable previews, it just starts failing again.
Have been trying all different combinations of canvas, running the app, killing deriveddata, cleaning build folder, etc. but haven't found anything that keeps it working. Closing and re-opening Xcode always seems to cause the error to happen again regardless.
I see the same issue with the same setup, Firebase 10.17, FBLPromises
2.3.1 and Xcode 15.
same issue with Firebase 10.18 and Xcode 15.0.1
Same issue with Firebase 10.23 and Xcode 15.3