Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sd_setImage(with:maxImageSize:placeholderImage:options:completion:) crashing the app when using .progressiveLoad #1146

Open
Idomo opened this issue Apr 23, 2023 · 1 comment

Comments

@Idomo
Copy link

Idomo commented Apr 23, 2023

Describe your environment

  • Objective C or Swift: Swift 5
  • iOS version: 16.4.1
  • Firebase SDK version: 10.8.0
  • FirebaseUI version: 13.0.0 (pod 'FirebaseUI/Storage')
  • CocoaPods Version: 1.11.2

Steps to reproduce:

  1. Make sure that the image isn't saved in cache.
  2. Call imageView.sd_setImage(with: fileReference, maxImageSize: UInt64(5 * 1024 * 1024), placeholderImage: placeholder, options: .progressiveLoad)

Observed Results:

The app is crashing at AppDelegate with:

-[FIRStorageDownloadTask fetcher]: unrecognized selector sent to instance 0x2804a94a0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRStorageDownloadTask fetcher]: unrecognized selector sent to instance 0x2804a94a0'
*** First throw call stack:
(0x1cf00ed94 0x1c80c43d0 0x1cf183b14 0x1cf0251c8 0x1cf08b9f0 0x1053b1070 0x10639901c 0x10639ab38 0x106399464 0x10639b43c 0x10637c5f8 0x106c68520 0x106c6a038 0x106c7a798 0x106c7a2dc 0x1cf09dd18 0x1cf07f650 0x1cf0844dc 0x20a2e435c 0x1d141037c 0x1d140ffe0 0x1049efb1c 0x1ee50cdec)
libc++abi: terminating due to uncaught exception of type NSException
(lldb) 
Thread 1 Queue : com.apple.main-thread (serial)
#0	0x000000020dd18558 in __pthread_kill ()
#1	0x000000022e996118 in pthread_kill ()
#2	0x00000001d652e178 in abort ()
#3	0x000000022e8d4bf8 in abort_message ()
#4	0x000000022e8c4444 in demangling_terminate_handler() ()
#5	0x00000001c80c9ea4 in _objc_terminate() ()
#6	0x000000022e8d3fbc in std::__terminate(void (*)()) ()
#7	0x000000022e8d3f60 in std::terminate() ()
#8	0x00000001c80dfd04 in objc_terminate ()
#9	0x0000000106c6a04c in _dispatch_client_callout ()
#10	0x0000000106c7a798 in _dispatch_main_queue_drain ()
#11	0x0000000106c7a2dc in _dispatch_main_queue_callback_4CF ()
#12	0x00000001cf09dd18 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#13	0x00000001cf07f650 in __CFRunLoopRun ()
#14	0x00000001cf0844dc in CFRunLoopRunSpecific ()
#15	0x000000020a2e435c in GSEventRunModal ()
#16	0x00000001d141037c in -[UIApplication _run] ()
#17	0x00000001d140ffe0 in UIApplicationMain ()
#18	0x00000001049efb1c in main at /path/AppDelegate.swift:21
#19	0x00000001ee50cdec in start ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#0	0x0000000106c6ed10 in dispatch_async ()
#1	0x00000001d76e38f8 in _swift_dispatch_async ()
#2	0x00000001d76e43f0 in OS_dispatch_queue.async(group:qos:flags:execute:) ()
#3	0x000000010639b180 in StorageObservableTask.fire(handlers:snapshot:) at /path/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageObservableTask.swift:175
#4	0x000000010639ac9c in StorageObservableTask.fire(for:snapshot:) at /path/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageObservableTask.swift:164
#5	0x00000001063809f0 in closure #2 in closure #1 in StorageDownloadTask.enqueueImplementation(resumeWith:) at /path/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageDownloadTask.swift:149
#6	0x0000000106380a84 in thunk for @escaping @callee_guaranteed (@unowned Int64, @unowned Int64) -> () ()
#7	0x00000001060af68c in __56-[GTMSessionFetcher URLSession:dataTask:didReceiveData:]_block_invoke_2 at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2831
#8	0x00000001060ae2f4 in __66-[GTMSessionFetcher invokeOnCallbackQueue:afterUserStopped:block:]_block_invoke at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2633
#19	0x00000001049efb1c in main at /path/AppDelegate.swift:21
Enqueued from  (Thread 28) Queue :  (serial)
#0	0x0000000106c6b988 in dispatch_group_async ()
#1	0x00000001060ae0cc in -[GTMSessionFetcher invokeOnCallbackQueue:afterUserStopped:block:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2609
#2	0x00000001060adfb8 in -[GTMSessionFetcher invokeOnCallbackUnsynchronizedQueueAfterUserStopped:block:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2602
#3	0x00000001060adf40 in -[GTMSessionFetcher invokeOnCallbackQueueAfterUserStopped:block:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2596
#4	0x00000001060ade54 in -[GTMSessionFetcher invokeOnCallbackQueueUnlessStopped:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2590
#5	0x00000001060af4d0 in -[GTMSessionFetcher URLSession:dataTask:didReceiveData:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2823
#6	0x00000001060c7ae4 in -[GTMSessionFetcherSessionDelegateDispatcher URLSession:dataTask:didReceiveData:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcherService.m:1333
Enqueued from com.apple.NSURLSession-work (Thread 28) Queue : com.apple.NSURLSession-work (serial)
Enqueued from com.apple.NSURLSession-work (Thread 28) Queue : com.apple.NSURLSession-work (serial)
Enqueued from  (Thread 28) Queue :  (serial)
#2	0x00000001060acc68 in __78-[GTMSessionFetcher URLSession:dataTask:didReceiveResponse:completionHandler:]_block_invoke at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2341
#3	0x00000001060aca08 in -[GTMSessionFetcher URLSession:dataTask:didReceiveResponse:completionHandler:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcher.m:2362
#4	0x00000001060c786c in -[GTMSessionFetcherSessionDelegateDispatcher URLSession:dataTask:didReceiveResponse:completionHandler:] at /path/Pods/GTMSessionFetcher/Sources/Core/GTMSessionFetcherService.m:1308
Enqueued from com.apple.NSURLSession-work (Thread 27) Queue : com.apple.NSURLSession-work (serial)
Enqueued from com.apple.NSURLSession-work (Thread 27) Queue : com.apple.NSURLSession-work (serial)
Enqueued from com.apple.CFNetwork.LoaderQ (Thread 2) Queue : com.apple.CFNetwork.LoaderQ (serial)
Thread#5	0x00000001053b1070 in __80-[FUIStorageImageLoader requestImageWithURL:options:context:progress:completed:]_block_invoke.17 at /path/Pods/FirebaseStorageUI/FirebaseStorageUI/Sources/FUIStorageImageLoader.m:134
#9	0x000000010639b43c in closure #1 in StorageObservableTask.fire(handlers:snapshot:) at /path/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageObservableTask.swift:176
#20	0x00000001d140ffe0 in UIApplicationMain ()
#21	0x00000001049efb1c in main at /path/AppDelegate.swift:21
#22	0x00000001ee50cdec in start ()

Expected Results:

The image should be loaded without crashing the app.

Relevant Code:

imageView.sd_setImage(with: fileReference, maxImageSize: UInt64(5 * 1024 * 1024), placeholderImage: placeholder, options: .progressiveLoad){ image, error, _, ref in
  ...
}

From my investigation it started since Firebase 9.0.0 (working fine with 8.15.0 also with FirebaseUI 13.0.0).
By #1114 (comment) it really seems like a recurring issue with .progressiveLoad, since without it or with another option (e.g. .lowPriority) it seems to work fine.

@Idomo
Copy link
Author

Idomo commented Apr 28, 2023

@morganchen12 Happens also with Firebase 10.9.0 and CocoaPods 1.12.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant