shorebird icon indicating copy to clipboard operation
shorebird copied to clipboard

fix: iOS app crashes on startup after Shorebird patch

Open anees22444 opened this issue 2 months ago • 8 comments

App ID 1f0f23a2-696c-43fa-b60f-d11ee3bf7acc

Warning Message [WARN] shorebird patch was only able to share 15.6% of Dart code with the released app.

Description

After running shorebird patch, I received the above warning. The patch was applied successfully, but the iOS app crashes immediately after startup.

I only made minimal Dart changes — around two files — and did not modify any native (platform) code.

Steps

  1. Made small changes in 2 Dart files.
  2. Ran shorebird patch for both Android and iOS simultaneously.
  3. Installed the patched version on iOS.
  4. Launched the app.
  5. Observed the crash immediately after startup on iOS only.

anees22444 avatar Nov 11 '25 15:11 anees22444

There are a couple things at play here:

  1. It appears as though you shipped a patch with native changes. This is almost certainly the cause of your crash, and exactly why we warn and strongly advise against doing so.
  2. That is an incredibly low link percentage. @eseidel might have questions there, although I would guess that the dependency updates made between the patch and the release probably have something to do with it.

bryanoltman avatar Nov 12 '25 18:11 bryanoltman

No native changes were done. Just Dart side and build number changed.

anees22444 avatar Nov 13 '25 13:11 anees22444

That's interesting. It doesn't appear as though your podfile changed. I'm at a bit of a loss for what might have caused this. Do you have any code you can share?

bryanoltman avatar Nov 17 '25 15:11 bryanoltman

15% is possibly the lowest link percentage I've seen. I'd love to learn more. When linking there is a patch-debug.zip file produced in the build directory. If you're interested in debugging more with us, we'd love to work with you to get a copy of that file. I'm also reachable on Discord directly.

It looks like recent builds of that app_id were built with Flutter 3.35.5 (6d66831e77)

It would also help if we could see a crash report from the device: https://developer.apple.com/documentation/xcode/acquiring-crash-reports-and-diagnostic-logs

If your'e able to get either a crash report or patch-debug.zip, I'd be very interested in helping you interpret such. Thanks.

eseidel avatar Nov 18 '25 21:11 eseidel

I'm honestly not sure how it's possible to get down to 15% link percentage. Even our "unrelated apps" linking tests link higher than that. 😦

eseidel avatar Nov 19 '25 23:11 eseidel

Just shared logs with you on discord

anees22444 avatar Nov 20 '25 12:11 anees22444

Thanks for sharing. This is the crashing thread:

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	       0x2343420cc __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1e6a60810 pthread_kill + 268
2   libsystem_c.dylib             	       0x196293ff4 __abort + 132
3   libsystem_c.dylib             	       0x196293f70 abort + 136
4   libc++abi.dylib               	       0x187ad3808 __abort_message + 132
5   libc++abi.dylib               	       0x187ac2484 demangling_terminate_handler() + 304
6   libobjc.A.dylib               	       0x1879d3f78 _objc_terminate() + 156
7   FirebaseCrashlytics           	       0x10221e4ac FIRCLSTerminateHandler() + 332
8   libc++abi.dylib               	       0x187ad2bdc std::__terminate(void (*)()) + 16
9   libc++abi.dylib               	       0x187ad6314 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 88
10  libc++abi.dylib               	       0x187ad62bc __cxa_throw + 92
11  libobjc.A.dylib               	       0x1879d197c objc_exception_throw + 448
12  CoreFoundation                	       0x18ab3f99c +[NSException raise:format:] + 128
13  FirebaseCore                  	       0x101f34dd4 +[FIRApp addAppToAppDictionary:] + 168
14  FirebaseCore                  	       0x101f34628 +[FIRApp configureWithName:options:] + 652
15  Runner                        	       0x1015ce428 0x100f70000 + 6677544
16  Runner                        	       0x1015d093c 0x100f70000 + 6687036
17  Flutter                       	       0x10468777c 0x103cc4000 + 10237820
18  Flutter                       	       0x104104294 0x103cc4000 + 4457108
19  libdispatch.dylib             	       0x1c2e50adc _dispatch_call_block_and_release + 32
20  libdispatch.dylib             	       0x1c2e6a7ec _dispatch_client_callout + 16
21  libdispatch.dylib             	       0x1c2e87b24 _dispatch_main_queue_drain.cold.5 + 812
22  libdispatch.dylib             	       0x1c2e5fec8 _dispatch_main_queue_drain + 180
23  libdispatch.dylib             	       0x1c2e5fe04 _dispatch_main_queue_callback_4CF + 44
24  CoreFoundation                	       0x18aa5c2c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
25  CoreFoundation                	       0x18aa0fb3c __CFRunLoopRun + 1944
26  CoreFoundation                	       0x18aa0ea6c _CFRunLoopRunSpecificWithOptions + 532
27  GraphicsServices              	       0x22b61c498 GSEventRunModal + 120
28  UIKitCore                     	       0x1903d2ba4 -[UIApplication _run] + 792
29  UIKitCore                     	       0x19037ba78 UIApplicationMain + 336
30  UIKitCore                     	       0x1904a768c 0x190335000 + 1517196
31  Runner                        	       0x100f784ac 0x100f70000 + 33964
32  dyld                          	       0x187a26e28 start + 7116

Presumably there is an accompanying log when you run the app. Since it looks like this is just an exception being thrown by FIRApp.

The internet seems to claim that FIRApp is an old API for Firebase. It may also be that the app would be served by updating to the newer firebase API. 🤷

eseidel avatar Nov 20 '25 17:11 eseidel

That’s strange. The issue occurred only after applying the patch.

anees22444 avatar Nov 21 '25 06:11 anees22444

In any case, would love to help if you're able to repro the crash locally and/or see the logs from a crashing device.

eseidel avatar Nov 25 '25 23:11 eseidel

Same here but I have warning message: [WARN] shorebird patch was only able to share 85.5% of Dart code with the released app.

fahami avatar Dec 19 '25 21:12 fahami