Crash when chaning drivingScrollView
Once again we have found a problem, that seems happen because of the changes to the way to find the drivingScrollView. Also once again I have not been able to create a simple example of the crash.
The problem
The problem seems to be caused by changing the content of the Overlay, so that the drivingScrollView is changed. By that I mean that there is a completely new drivingScrollView. This I was able to determine, because we have found that a possible workaround is to only have a single ScrollView that is always the drivingScrollView. Unfortunately that would render the changes to find the correct scroll view nearly useless.
The following stacktrace/crashreport is reported by XCode:
2022-02-28 09:27:46.519653+0100 localion-navigator[8506:187521] -[OverlayContainer.OverlayScrollViewDelegateProxy tableView:shouldDrawTopSeparatorForSection:]: unrecognized selector sent to instance 0x6000019cd890
2022-02-28 09:27:46.525599+0100 localion-navigator[8506:187521] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OverlayContainer.OverlayScrollViewDelegateProxy tableView:shouldDrawTopSeparatorForSection:]: unrecognized selector sent to instance 0x6000019cd890'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff203feba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2040d811 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00007fff204030ac ___forwarding___ + 1433
4 CoreFoundation 0x00007fff204051d8 _CF_forwarding_prep_0 + 120
5 UIKitCore 0x00007fff252a7f36 -[UITableView _shouldDrawSeparatorAtTopOfSectionForCellAtIndexPath:] + 148
6 UIKitCore 0x00007fff252a7a23 -[UITableView _updateSeparatorStateForCell:atIndexPath:] + 96
7 UIKitCore 0x00007fff25294287 -[UITableView _updateAnimationDidStopWithOldVisibleViews:finished:context:] + 2127
8 UIKitCore 0x00007fff25293187 __46-[UITableView _updateWithItems:updateSupport:]_block_invoke.1168 + 41
9 libdispatch.dylib 0x000000010e3c7848 _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x000000010e3c8a2c _dispatch_client_callout + 8
11 libdispatch.dylib 0x000000010e3d71f1 _dispatch_main_queue_callback_4CF + 1197
12 CoreFoundation 0x00007fff2036c84d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13 CoreFoundation 0x00007fff203670aa __CFRunLoopRun + 2772
14 CoreFoundation 0x00007fff203660f3 CFRunLoopRunSpecific + 567
15 GraphicsServices 0x00007fff2c995cd3 GSEventRunModal + 139
16 UIKitCore 0x00007fff25059f42 -[UIApplication _run] + 928
17 UIKitCore 0x00007fff2505eb5e UIApplicationMain + 101
18 SwiftUI 0x00007fff5d0d5dcf $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 196
19 SwiftUI 0x00007fff5d0d5d09 $s7SwiftUI6runAppys5NeverOxAA0D0RzlF + 148
20 SwiftUI 0x00007fff5cabdbad $s7SwiftUI3AppPAAE4mainyyFZ + 61
21 localion-navigator 0x000000010d312323 $s18localion_navigator20LocalionNavigatorAppV5$mainyyFZ + 35
22 localion-navigator 0x000000010d3123a9 main + 9
23 dyld 0x000000010e33dee9 start_sim + 10
24 ??? 0x0000000118d974fe 0x0 + 4711871742
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OverlayContainer.OverlayScrollViewDelegateProxy tableView:shouldDrawTopSeparatorForSection:]: unrecognized selector sent to instance 0x6000019cd890'
CoreSimulator 802.4 - Device: iPhone 13 Pro (961BD13A-39F2-450A-9FDC-EE43C7D79706) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 13 Pro
terminating with uncaught exception of type NSException
With all the problems that the new solution seems to incur, I'm starting to believe that it is to fragile. Maybe instead the solution that I had proposed would be better (determining it through the accessibilityIdentifier), even if we need to use UIViewControlelrRepresentable to make it work. The restriction to not put an Overlay into a NavigationView if the title should be hidden seems less of a problem to me than this.
Hey @Lumentus! :)
It looks like an OverlayContainer problem 🤔
I tried to reproduce the issue… but I couldn't. I would need a sample code… I successfully changed the driving scroll view while changing the content.
Hey @gaetanzanella
Well if you can check in OverlayContainer, if the drivingScrollView still exists, then I would classify it as a OverlayContainer Problem. And yes I would love to give you an example, but I still have not managed to make an example, only our production code has this problem and as you can guess, I'm not allowed to upload that.