shorebird
                                
                                 shorebird copied to clipboard
                                
                                    shorebird copied to clipboard
                            
                            
                            
                        fix: `shorebird preview` on iOS hangs on white screen for long time
I'm not sure why. And I'm not sure if it's always done this, or only recently.
But when I use shorebird preview to install an iOS app, it hangs on a white screen for 10s+. Once it's done that, then I can launch the app from the phone just fine (clicking on the icon on the home screen) and that launches instant.
So this may just be an xcode/install/verify thing? Or maybe we regressed something in Shorebird?
We got another report of this (not using preview). We may need to investigate this for 1.0: https://discord.com/channels/1030243211995791380/1030243213002412164/1202600327724142712
Trying to find a consistent way to reproduce this now
Failure to reproduce so far (although I have seen this and know it's a real issue). So far, I've tried:
- Using package:shorebird_code_pushto check for and download updates in_MyHomePageState'sinitState. This works fine.
- Using the network link conditioner to simulate bad/no network. This works fine also.
I've seen it w/o using package:shorebird_code_push. I think most commonly when I run from XCode?
From our convo just now, to capture it here:
Xcode holds pauses all apps (not just Flutter) while waiting for a debugger to attach. shorebird preview does not do this – for iOS 17+ devices, we use a combination of devicectl (to install and launch the app) and isyslog (to get log output from the device), and for pre-iOS 17, we use ios-deploy.
If we were able to isolate this issue to either only iOS >= 17 or <17, that would be amazing. Haven't gotten there yet though :(
Anyone who sees this, we would love to work with you to better understand. We see it occasionally, but are not able to reproduce. We're not yet sure if it's XCode or Shorebird or Flutter or some combination.
We got another similar report just now on Discord.
I think that maybe our rust code is hanging during startup for some reason.
https://discord.com/channels/1030243211995791380/1125516353370075306/1209092882900717648
Got another report of similar behavior when installing the app from Google Play (they said shorebird preview works fine).
https://discord.com/channels/1030243211995791380/1125516353370075306/1210249949711826964
It's possible this is caused by https://github.com/shorebirdtech/shorebird/issues/1731.
Not only preview but also usual flow facing this issue too. Please fix it.
We got another similar report just now on Discord.
I think that maybe our rust code is hanging during startup for some reason.
https://discord.com/channels/1030243211995791380/1125516353370075306/1209092882900717648
@luatvudinh One of the challenges we've had with this issue is reproducing it. I think we've all seen it happen once or twice, but have not been able to consistently trigger this issue, which has made finding the cause difficult. Do you have a code sample or a set of steps that reliably causes this to happen?
@luatvudinh One of the challenges we've had with this issue is reproducing it. I think we've all seen it happen once or twice, but have not been able to consistently trigger this issue, which has made finding the cause difficult. Do you have a code sample or a set of steps that reliably causes this to happen?
It's tough for me. Our project is quite huge and do not have time to make a reproduce project. Our flow with these steps:
- Release with the command:
shorebird release ios --flavor <my_flavor> -- --dart-define-from-file=config/<my_config>.json --export-options-plist=<file_path>
- Patch:
shorebird patch ios --flavor <my_flavor> -- --dart-define-from-file=config/<my_config>.json --export-options-plist=<file_path>
It will be useful if I send you our app-id or project dependencies? Please tell me what I can do to help your progress.
Thanks for your reply.
Both app-id and dependencies would be very useful. Knowing what your app does between the start of main() and when the first frame is rendered would be helpful as well.
- My app id: a83eaaff-3a2f-427d-9062-dbeedde4f36d
- Dependencies:
environment:
  sdk: '>=3.1.5 <4.0.0'
dependencies:
  flutter:
    sdk: flutter
  get:
  json_annotation: ^4.8.1
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  logger: ^2.0.1
  oktoast: ^3.3.2+1
  dio: ^5.3.2
  retrofit: '>=4.0.0 <5.0.0'
  get_it: ^7.6.0
  get_storage: ^2.1.1
  freezed: ^2.4.6
  captcha_plugin_flutter: ^1.1.6
  easy_localization: ^3.0.3
  cupertino_icons: ^1.0.2
  crypto: ^3.0.3
  intl: ^0.18.1
  flutter_svg: ^2.0.9
  pull_to_refresh: ^2.0.0
  skeletonizer: ^1.1.0
  device_info_plus: ^9.1.1
  scrollable_positioned_list: ^0.3.8
  syncfusion_flutter_datepicker: ^24.1.41
  freezed_annotation: ^2.4.1
  webview_flutter: ^4.2.4
  webview_flutter_web: ^0.2.2+4
  webview_flutter_platform_interface: ^2.10.0
  flutter_sticky_header: ^0.6.5
  scrollview_observer: ^1.19.0
  permission_handler: ^11.1.0
  mobile_scanner: ^3.5.5
  image_picker: ^1.0.5
  image_gallery_saver: ^2.0.3
  camera: ^0.10.5+9
  zxing2: ^0.2.1
  image: ^4.1.3
  cached_network_image: ^3.3.0
  flutter_alice: ^1.1.1
  flutter_keyboard_visibility: ^6.0.0
  web_socket_channel: ^2.1.0
  connectivity_plus: ^4.0.0
  emoji_picker_flutter: ^1.6.3
  http_parser: ^4.0.2
  flutter_image_compress: ^2.1.0
  universal_html: ^2.2.4
  record: ^5.0.4
  path: ^1.8.3
  path_provider: ^2.0.1
  audioplayers: ^5.2.1
  country_picker: ^2.0.23
  qr_code_scanner: ^1.0.1
  lottie: ^2.7.0
  flutter_slidable: ^3.0.1
  collection: ^1.18.0
  scroll_to_index: ^3.0.1
  video_player: ^2.8.2
  chewie: ^1.7.4
  gallery_saver: ^2.3.2
  widgets_to_image: any
  video_compress: ^3.1.2
  sqflite: ^2.3.0
  html_unescape: ^2.0.0
  fl_chart: ^0.66.0
  percent_indicator: ^4.2.3
  wakelock_plus: ^1.1.1
  vector_math: ^2.1.1
  carousel_slider: ^4.2.1
  flutter_rating_bar: ^4.0.1
  palette_generator: ^0.3.3+3
  syncfusion_flutter_charts: ^24.2.3
  pin_code_fields: ^8.0.1
  flutter_staggered_animations: ^1.1.1
  vibration: ^1.8.4
  url_launcher: ^6.2.5
  dropdown_button2: ^2.3.9
  popover: ^0.3.0
  pushy_flutter: 2.0.18
  flutter_html: ^3.0.0-beta.2
  shorebird_code_push: ^1.1.3
  package_info_plus: ^5.0.1
  restart_app:
    git:
      url: 'https://github.com/luatvudinh/restart_app.git'
  flutter_local_notifications: ^16.3.2
  shake: ^2.2.0
  flutter_app_badger: ^1.5.0
  url_strategy: ^0.2.0
  test: ^1.24.9
  uni_links: ^0.5.1
  share_plus: ^7.2.2
  visibility_detector: ^0.4.0+2
  redacted: ^1.0.11
  sliver_tools: ^0.2.12
  extended_nested_scroll_view: ^6.2.1
  flutter_screenutil: ^5.9.0
  video_player_web_hls: ^1.0.0+3
  sqflite_common_ffi_web: ^0.4.2+3
  encrypt: ^5.0.3
  flutter_app_installer: ^1.0.0
dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.4.7
  mockito: ^5.4.4
  flutter_gen_runner: '>=5.0.0 <6.0.0'
  hive_generator: ^2.0.0
  json_serializable: ^6.7.1
  retrofit_generator: any
  easy_localization_generator: ^0.3.1
  flutter_lints: ^3.0.1
  dart_code_metrics: ^5.7.6
- In the mainfunction we create someDios, storage manager and some other stuffs. ThenrunAppwith layer stackEasyLocalization->OKToast-> StatefulWidget with child isContainer>ScreenUtilInit(flutter_screenutil) >GetMaterialApp.
- The first frame showing after restart (patch installed) is NATIVE SPLASH SCREEN (dart code was not called) and no change for a long time stayed. Restart multiple times and app behaved the same.
Hope this info is enough to reproduce because that's all info I can provide.
Our current theory is that this was caused by https://github.com/shorebirdtech/shorebird/issues/1731, which we fixed back in 3.19.6 or there abouts.