Repository: flutter
Issue: [iOS] objc_retain_x0 EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)
Labels: c: crash,platform-ios,engine,a: production,P2,team-ios,triaged-ios

## Steps to Reproduce

I have no idea how to reproduce this unfortunately as it happened only once with my live app on the Apple Store. 
I have never encountered this during debug or in `release` mode during development. 

The [app](https://apps.apple.com/us/app/infeelib/id6446111463) on the store.

Here is the trace : 

<details>
<summary>StackTrace</summary>

```
Crashlytics - Stack trace
Application: com.myappname.ios
Platform: apple
Version: 1.0.2 (2)
Issue: bf4df414a00c92ea0c71a74e6ffd9c44
Session: ca04eef694f14abbb7fc35896bcd63e2_DNE_3_v2
Date: Thu Apr 06 2023 13:01:30 GMT+0200 (heure d’été d’Europe centrale)

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x2e5c objc_retain_x0 + 16
1  libobjc.A.dylib                0x2e5c objc_retain + 16
2  UIKitCore                      0xb91d08 -[UIKeyboardImpl setDelegate:force:fromBecomeFirstResponder:] + 2500
3  UIKitCore                      0x559238 -[UIKeyboardAutomatic willResume:] + 412
4  CoreFoundation                 0x373b4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
5  CoreFoundation                 0xde444 ___CFXRegistrationPost_block_invoke + 88
6  CoreFoundation                 0xc16f4 _CFXRegistrationPost + 440
7  CoreFoundation                 0x4b9b8 _CFXNotificationPost + 704
8  Foundation                     0x5cd0c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
9  UIKitCore                      0x1a4664 -[UIApplication _sendWillEnterForegroundCallbacks] + 224
10 UIKitCore                      0x1a41a0 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 1272
11 UIKitCore                      0x9de74 _UIScenePerformActionsWithLifecycleActionMask + 108
12 UIKitCore                      0x3dfd78 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216
13 UIKitCore                      0x290adc -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 220
14 UIKitCore                      0x290904 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 620
15 UIKitCore                      0x2904b4 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 252
16 UIKitCore                      0x290380 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 148
17 UIKitCore                      0x97456c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736
18 UIKitCore                      0xa0e568 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224
19 UIKitCore                      0x13c374 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316
20 UIKitCore                      0x5af294 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.214 + 556
21 UIKitCore                      0x20e9a0 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216
22 UIKitCore                      0x20e810 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244
23 UIKitCore                      0x20e650 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336
24 FrontBoardServices             0x366c -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 420
25 FrontBoardServices             0x34a8 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 144
26 FrontBoardServices             0x6c24 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
27 FrontBoardServices             0x6b40 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 340
28 libdispatch.dylib              0x3f88 _dispatch_client_callout + 20
29 libdispatch.dylib              0x7a08 _dispatch_block_invoke_direct + 264
30 FrontBoardServices             0x10d40 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
31 FrontBoardServices             0x108dc -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
32 FrontBoardServices             0x13184 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
33 CoreFoundation                 0xd5f24 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
34 CoreFoundation                 0xe22fc __CFRunLoopDoSource0 + 176
35 CoreFoundation                 0x661c0 __CFRunLoopDoSources0 + 244
36 CoreFoundation                 0x7bb7c __CFRunLoopRun + 836
37 CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
38 GraphicsServices               0x1368 GSEventRunModal + 164
39 UIKitCore                      0x3a1668 -[UIApplication _run] + 888
40 UIKitCore                      0x3a12cc UIApplicationMain + 340
41 Runner                         0x6034 main + 5 (AppDelegate.swift:5)
42 ???                            0x1c4028960 (Missing)

com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x12ec mach_msg + 24
4  CoreFoundation                 0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
7  Foundation                     0x42054 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  Foundation                     0x41f3c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9  UIKitCore                      0x4d66a4 -[UIEventFetcher threadMain] + 436
10 Foundation                     0x5b518 __NSThread__start__ + 716
11 libsystem_pthread.dylib        0x16cc _pthread_start + 148
12 libsystem_pthread.dylib        0xba4 thread_start + 8

io.flutter.1.ui
0  libsystem_kernel.dylib         0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x12ec mach_msg + 24
4  CoreFoundation                 0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
7  Flutter                        0x2d9f6c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
8  Flutter                        0x2d9a5c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

io.flutter.1.raster
0  libsystem_kernel.dylib         0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x12ec mach_msg + 24
4  CoreFoundation                 0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
7  Flutter                        0x2d9f6c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
8  Flutter                        0x2d9a5c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

io.flutter.1.io
0  libsystem_kernel.dylib         0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x12ec mach_msg + 24
4  CoreFoundation                 0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
7  Flutter                        0x2d9f6c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
8  Flutter                        0x2d9a5c (Missing UUID 4c4c443255553144a12105aa4b06a34f)
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.1
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.2
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.3
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.4
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.5
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

io.worker.6
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  Flutter                        0x48574 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x2d4174 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

dart:io EventHandler
0  libsystem_kernel.dylib         0x26e0 kevent + 8
1  Flutter                        0x4c3e50 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
2  Flutter                        0x4f4108 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  libsystem_pthread.dylib        0x16cc _pthread_start + 148
4  libsystem_pthread.dylib        0xba4 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
0  FirebaseCrashlytics            0x1e3dc FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393)
1  FirebaseCrashlytics            0x1e7bc FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424)
2  FirebaseCrashlytics            0x1592c FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  FirebaseCrashlytics            0x18188 FIRCLSMachExceptionServer + 521 (FIRCLSMachException.c:521)
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x12ec mach_msg + 24
4  CoreFoundation                 0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80eb0 CFRunLoopRunSpecific + 612
7  CFNetwork                      0x257ff0 _CFURLStorageSessionDisableCache + 61088
8  Foundation                     0x5b518 __NSThread__start__ + 716
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

com.apple.coreaudio.AQClient
0  libsystem_kernel.dylib          0xda8 mach_msg2_trap + 8
1  libsystem_kernel.dylib          0x13a1c mach_msg2_internal + 80
2  libsystem_kernel.dylib          0x13c5c mach_msg_overwrite + 388
3  libsystem_kernel.dylib          0x12ec mach_msg + 24
4  CoreFoundation                  0x7aac4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                  0x7bd08 __CFRunLoopRun + 1232
6  CoreFoundation                  0x80eb0 CFRunLoopRunSpecific + 612
7  AudioToolbox                    0x1d7010 <redacted> + 164
8  libAudioToolboxUtility.dylib    0x14354 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92
9  libsystem_pthread.dylib         0x16cc _pthread_start + 148
10 libsystem_pthread.dylib         0xba4 thread_start + 8

caulk.messenger.shared:high
0  libsystem_kernel.dylib         0xd24 semaphore_wait_trap + 8
1  caulk                          0x2888 caulk::mach::semaphore::wait_or_error() + 28
2  caulk                          0x2fc0 caulk::concurrent::details::worker_thread::run() + 56
3  caulk                          0x3788 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 96
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

Thread
0  libsystem_kernel.dylib         0x12b0 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x12b0 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_pthread.dylib        0xb90 start_wqthread + 254

Thread
0  libsystem_pthread.dylib        0xb90 start_wqthread + 254

Thread
0  libsystem_pthread.dylib        0xb90 start_wqthread + 254

Thread
0  libsystem_kernel.dylib         0x12b0 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

DartWorker
0  libsystem_kernel.dylib         0x167c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x8098 _pthread_cond_wait + 1276
2  Flutter                        0x63b914 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
3  Flutter                        0x679458 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
4  Flutter                        0x63b2e0 (Missing UUID 4c4c443255553144a12105aa4b06a34f)
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8
```

</details>

**Expected results:** <!-- what did you want to see? -->

The app should not crash.

**Actual results:** <!-- what did you see? -->

The app is crashing on on iOS.

<details>
  <summary>Logs</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 3.7.10, on macOS 13.3 22E252 darwin-x64, locale fr-FR)
    • Flutter version 3.7.10 on channel stable at /Users/foxtom/Desktop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4b12645012 (3 days ago), 2023-04-03 17:46:48 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/foxtom/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.77.1)
    • VS Code at /Users/foxtom/Desktop/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (3 available)
    • Now You See Me (mobile) • 00008020-001204401E78002E • ios            • iOS 16.3.1 20D67
    • macOS (desktop)         • macos                     • darwin-x64     • macOS 13.3 22E252 darwin-x64
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 112.0.5615.49

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

Note : The app crashed with `flutter: 3.7.9` 

</details>