My code is trying to use sd_setImage to load an image stored in a Firebase Storage. I'm using the Firebase Emulator and have loaded some images in a folder in the emulator under, well, "images". I've attempted this both in my own app and in the sample app from FirebaseUI-demo.
The exception I receive is
2022-10-30 19:38:50.916495-0600 FirebaseUI-demo-swift[32333:257475] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRStorageTask fetcher]: unrecognized selector sent to instance 0x6000025169d0'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff800427378 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004dbaf objc_exception_throw + 48
2 CoreFoundation 0x00007ff800436588 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00007ff80042b83d ___forwarding___ + 1431
4 CoreFoundation 0x00007ff80042db38 _CF_forwarding_prep_0 + 120
5 FirebaseStorageUI 0x000000010fa5a6c0 __80-[FUIStorageImageLoader requestImageWithURL:options:context:progress:completed:]_block_invoke.53 + 128
6 FirebaseStorage 0x000000010fd6e889 $s15FirebaseStorage0B12TaskSnapshotCIeyBy_ACIegg_TR + 25
7 FirebaseStorage 0x000000010fd6e698 $s15FirebaseStorage0B14ObservableTaskC7observe_7handlerSSAA0bD6StatusO_yAA0bD8SnapshotCctFySo014FIRIMPLStoragedH0CcfU_ + 168
8 FirebaseStorage 0x000000010fd6e74a $sSo26FIRIMPLStorageTaskSnapshotCIegg_ABIeyBy_TR + 58
9 FirebaseStorageInternal 0x000000010ff9db44 __54-[FIRIMPLStorageObservableTask fireHandlers:snapshot:]_block_invoke_2 + 36
10 libdispatch.dylib 0x00000001106c2d18 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x00000001106c3f5b _dispatch_client_callout + 8
12 libdispatch.dylib 0x00000001106d4d55 _dispatch_main_queue_drain + 1463
13 libdispatch.dylib 0x00000001106d4790 _dispatch_main_queue_callback_4CF + 31
14 CoreFoundation 0x00007ff8003869f7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x00007ff8003813c6 __CFRunLoopRun + 2482
16 CoreFoundation 0x00007ff800380637 CFRunLoopRunSpecific + 560
17 GraphicsServices 0x00007ff809c0f28a GSEventRunModal + 139
18 UIKitCore 0x000000011bd9e425 -[UIApplication _run] + 994
19 UIKitCore 0x000000011bda3301 UIApplicationMain + 123
20 FirebaseUI-demo-swift 0x000000010f1c316f main + 63
21 dyld 0x000000010f48d2bf start_sim + 10
22 ??? 0x000000011523052e 0x0 + 4649583918
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRStorageTask fetcher]: unrecognized selector sent to instance 0x6000025169d0'
terminating with uncaught exception of type NSException
CoreSimulator 857.7 - Device: iPhone 14 Pro (2935292C-6CCB-4EB6-9B9B-58EA25365753) - Runtime: iOS 16.0 (20A360) - DeviceType: iPhone 14 Pro
Looking in the emulator log, it seems like the fetch succeeded:
Starting DownloadTask
2022-10-31 01:38:50 +0000 elapsed: 0.054sec
Request: GET http://localhost:9199/v0/b/xxxxxx-3df69.appspot.com/o/images%2Fbess.jpg?alt=media
Request headers:
User-Agent: com.google.firebase.firebaseui.FirebaseUI-demo-swift/1.0 iPhone/16.0 hw/sim
x-firebase-gmpid: 1:1092111096994:ios:4fff06c4faedf6306c4bfb
x-firebase-storage-version: ios/9.6.0
Response: status 200
Response headers:
Accept-Ranges: bytes
Access-Control-Expose-Headers: content-type,x-firebase-storage-version,x-goog-upload-url,x-goog-upload-status,x-goog-upload-command,x-gupload-uploadid,x-goog-upload-header-content-length,x-goog-upload-header-content-type,x-goog-upload-protocol,x-goog-upload-status,x-goog-upload-chunk-granularity,x-goog-upload-control-url
Connection: keep-alive
Content-Disposition: inline
Content-Length: 537875
Content-Type: image/jpeg
Date: Mon, 31 Oct 2022 01:38:50 GMT
Keep-Alive: timeout=5
Vary: Origin
X-Powered-By: Express
Response body: (537875 bytes)
<<537875 bytes>>
And if I use the URL embedded in the GET above, it does fetch the image.
I get the same behavior in my app as well as the sample app. I have set both to use the emulator via:
Storage.storage().useEmulator(withHost:"localhost", port:9199)
I've updated all of my npm and firebase-tools. Help appreciated!