Skip to content

SwiftUI Previews crashes on FBLPromise with unrecognized selector #8005

Description

@simba909

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.5
  • Firebase SDK version: 7.8.1 or 7.11
  • Installation method: Zip file
  • Firebase Component: Analytics, Database, Firestore, Storage

[REQUIRED] Step 2: Describe the problem

With Firebase set up in an iOS app, I cannot run SwiftUI Previews (and just previewing itself crashes frequently). Running the app in a simulator / on a device is fine and doesn't generate any warnings or errors in the Xcode console output.

This looks very similar to what was reported in #7939, but we're using the Zip distribution and it only affects SwiftUI previews.

This can be reproduced with a minimal sample app:

Steps to reproduce:

  • Set up a new Xcode project for iOS
  • Set up a Firebase project for the app to get a GoogleService-Info.plist
  • Add Firebase 7.11 (or 7.8.1, both have the same issue) from the zip distribution with the following SDKs:
    • FirebaseAnalytics
    • FirebaseDatabase
    • FirebaseFirestore
    • FirebaseStorage
  • Add import FirebaseCore and FirebaseApp.configure() to the AppDelegate as the zip readme instructs
  • Add a SwiftUI view (if the project isn't SwiftUI already)
  • Resume the SwiftUI Preview in Xcode (this might already trigger the issue, might not)
  • If the issue hasn't been triggered by the step above, click the little "Run" button in the Preview Canvas and watch the preview immediately crash

Log from Console.app:

Process:               MyApp [18188]
Path:                  <redacted>
Identifier:            MyApp
Version:               1.0 (1)
Code Type:             ARM-64 (Native)
Parent Process:        launchd_sim [70680]
Responsible:           SimulatorTrampoline [14098]
User ID:               501

Date/Time:             2021-04-29 11:28:37.611 +0200
OS Version:            macOS 11.3 (20E232)
Report Version:        12
Anonymous UUID:        <redacted>

Sleep/Wake UUID:       <redacted>

Time Awake Since Boot: 120000 seconds
Time Since Wake:       15000 seconds

System Integrity Protection: enabled

Crashed Thread:        7  Dispatch queue: com.google.GDTCCTUploader

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600001ea4720'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 757.5 - Device: iPhone 12 Pro (4631766E-9C43-461C-8EB6-2B639CEE6CB0) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 12 Pro

Application Specific Backtrace 1:
0   CoreFoundation                      0x0000000104599978 __exceptionPreprocess + 236
1   libobjc.A.dylib                     0x0000000103719800 objc_exception_throw + 56
2   CoreFoundation                      0x00000001045a8f14 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3   CoreFoundation                      0x000000010459dbf0 ___forwarding___ + 1408
4   CoreFoundation                      0x000000010459fe7c _CF_forwarding_prep_0 + 92
5   MyApp                               0x0000000102ab0024 -[GDTCCTUploadOperation updateNextUploadTimeWithResponse:forTarget:] + 64
6   MyApp                               0x0000000102aaf8d0 __64-[GDTCCTUploadOperation sendURLRequestWithBatch:target:storage:]_block_invoke + 76
7   MyApp                               0x0000000102aac514 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.48 + 52
8   libdispatch.dylib                   0x0000000109f4a580 _dispatch_call_block_and_release + 24
9   libdispatch.dylib                   0x0000000109f4bd44 _dispatch_client_callout + 16
10  libdispatch.dylib                   0x0000000109f52dcc _dispatch_lane_serial_drain + 968
11  libdispatch.dylib                   0x0000000109f537f8 _dispatch_lane_invoke + 400
12  libdispatch.dylib                   0x0000000109f5da58 _dispatch_workloop_worker_thread + 744
13  libsystem_pthread.dylib             0x00000001bca3b754 _pthread_wqthread + 272
14  libsystem_pthread.dylib             0x00000001bca3a524 start_wqthread + 8

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00000001bc9fe470 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001bc9fe814 mach_msg + 72
2   com.apple.CoreFoundation      	0x000000010450783c __CFRunLoopServiceMachPort + 368
3   com.apple.CoreFoundation      	0x0000000104501d3c __CFRunLoopRun + 1136
4   com.apple.CoreFoundation      	0x00000001045013bc CFRunLoopRunSpecific + 572
5   com.apple.GraphicsServices    	0x0000000114dc770c GSEventRunModal + 160
6   com.apple.UIKitCore           	0x000000010e0eb3d0 -[UIApplication _run] + 964
7   com.apple.UIKitCore           	0x000000010e0f01ac UIApplicationMain + 112
8   libswiftUIKit.dylib           	0x0000000109cf316c UIApplicationMain(_:_:_:_:) + 100
9   com.example.MyApp              	0x0000000102aa3294 static UIApplicationDelegate.main() + 120
10  com.example.MyApp              	0x0000000102aa320c static AppDelegate.$main() + 108 (AppDelegate.swift:11)
11  com.example.MyApp              	0x0000000102aa332c main + 32
12  libdyld.dylib                 	0x0000000109fdd554 start + 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    SwiftUIIssues directly related to Apple's SwiftUI framework

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions