shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2.34k stars 141 forks source link

fix: Patch not installing on iOS #1536

Closed Oladips closed 10 months ago

Oladips commented 11 months ago

Description

Screenshot 2023-11-27 at 14 51 54 Screenshot 2023-11-27 at 14 51 59 Screenshot 2023-11-27 at 14 52 14 Screenshot 2023-11-27 at 14 52 17

The first two images show my android app with 3 patches installed and the patch insights. The last two show the same app but on IOS and I build patches successfully but it doesn't install on devices.

eseidel commented 11 months ago

Hmm. When you run shorebird preview I presume it successfully gets a patch on iOS?

Oladips commented 11 months ago
Screenshot 2023-11-30 at 16 29 57

I've cancelled and done this three times, I decided to leave it on the third try and it's still reading

bryanoltman commented 11 months ago

Can you share your app ID? That will help us get more info about what's going wrong.

Oladips commented 11 months ago

Okay this is it: 802410a9-2b63-486b-bb6a-d314c94075fb

Oladips commented 11 months ago

@bryanoltman

bryanoltman commented 11 months ago

Hmm, we don't seem to have any apps with that ID. Did you delete the app in the Shorebird console?

Oladips commented 11 months ago

Oh sorry about that, I shared the wrong ID This is the ID for the production flavor

70f58f3e-115c-4732-9027-354319eb0a44

bryanoltman commented 11 months ago

It looks like iOS releases and patches for several versions (including the one shown in your screenshot) have successfully been created, but the only two versions of that app I see in our patch check request logs are 3.0.1+2 and 3.0.0+49.

Can you run shorebird preview -v with to attempt to preview one of those versions to see what the debug output is? I'm looking for two things:

  1. Why the preview command is stalling
  2. Once the app successfully launches, what release version is it sending to the server in its patch check request?
Oladips commented 11 months ago
Screenshot 2023-12-08 at 20 54 09

I get an error, unable to find shorebird.yaml when I try to preview those two versions but the other versions don't return this error.

Oladips commented 11 months ago

This issue is allowing me upload new release on app store for the most minute change and go through the review process over again and again 😣. I'm creating new releases and patches but it's not changing in production.

Please what can I do to fix this on iOS. @bryanoltman

bryanoltman commented 11 months ago

Hmm, that's a very confusing error, as your release artifact definitely does contain a shorebird.yaml file. Can you run the preview command with the -v flag and paste (not screenshot) the output here?

Oladips commented 11 months ago

✓ Fetching releases (0.6s) Which release would you like to preview? 2.0.2+37 ✓ Using production track (11.9s) [Process.run] java -jar /Users/===/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar dump manifest --bundle=/Users/===/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/android_2.0.2+37.aab --xpath /manifest/@package ✓ Extracting metadata (0.3s) [Process.run] java -jar /Users/===/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar build-apks --overwrite --bundle=/Users/===/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/android_2.0.2+37.aab --output=/Users/===/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/android_2.0.2+37.apks --mode=universal ✓ Building apks (6.1s) [Process.run] java -jar /Users/===/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar install-apks --apks=/Users/===/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/android_2.0.2+37.apks --allow-downgrade ✓ Installing apks (4.0s) [Process.run] /Users/===/Library/Android/sdk/platform-tools/adb shell pm clear ng.apexnetwork.apex_network ⠙ Starting app... (81ms)[Process.run] /Users/===/Library/Android/sdk/platform-tools/adb shell monkey -p ng.apexnetwork.apex_network 1 ✓ Starting app (0.5s) [Process.start] /Users/===/Library/Android/sdk/platform-tools/adb logcat -T 1 -s flutter --------- beginning of main --------- beginning of kernel

12-11 18:33:08.879 6459 6459 I flutter : [INFO:shorebird.cc(102)] Shorebird updater: no active patch. 12-11 18:33:08.879 6459 6459 I flutter : [INFO:shorebird.cc(106)] Starting Shorebird update

--------- beginning of system

12-11 18:33:09.176 6459 6459 E flutter : updater::c_api: Error initializing updater: Invalid State: shorebird_init has already been called. 12-11 18:33:09.176 6459 6535 E flutter : updater::updater: Update failed: Update already in progress 12-11 18:33:09.176 6459 6535 I flutter : updater::updater: Update thread finished with status: Update had error

12-11 18:33:12.314 6459 6490 I flutter : updater::updater: Patch 4 successfully installed. 12-11 18:33:12.314 6459 6490 I flutter : updater::updater: Update thread finished with status: Update installed


Like I said I have no issues running the preview on Android, it works seamlessly as you can see from a version preview above. But on iOS, when I run a preview of either 3.0.0+49 or 3.0.1+2 I immediately get an exception error: Unable to find shorebird

✓ Fetching releases (0.6s) Which release would you like to preview? 3.0.1+2 ✗ Exception: Unable to find shorebird.yaml (3ms)


And any other iOS version apart from those two just runs infinitely without starting a preview

✓ Fetching releases (1.4s) Which release would you like to preview? 3.1.4+3 ✓ Using production track (17ms) [Process.run] xcrun devicectl --version ⠙ Locating device for run... (82ms)[Process.run] xcrun devicectl list devices --timeout 5 --json-output /var/folders/nh/jp5bsvys5z385hw19pnq0v8c0000gn/T/7eC3e8/devicectl.out.json ✓ Locating device for run (0.2s) Using ios-deploy to install and launch. [Process.start] /Users/===/.shorebird/bin/cache/flutter/39df2792f537b1fc62a9c668a6990f585bd91456/bin/cache/artifacts/ios-deploy/ios-deploy --debug -r --bundle /Users/===/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/ios_3.1.4+3.app [....] Waiting for iOS device to be connected ⠸ Starting app... (2091.4s)

bryanoltman commented 11 months ago

To make sure I'm understanding correctly, you've gotten other versions of your iOS app to work with shorebird, and it's just only these two that are causing problems? If that's right, do you know of anything that makes these two versions different from the others?

Oladips commented 11 months ago

No you mentioned that these two versions are the only versions showing up on logs and it's only those two that give the exception error.

There's nothing fundamentally different from all the releases I've been making. The only change I can see or note is those two releases were made before the switch to the xarchive update on shorebird.

I've created other versions on iOS but none of them installs patch. When I create a new release on iOS and I push a patch to that release, the patch change doesn't show up on the release.

bryanoltman commented 11 months ago

Hmm, I think I'll need more information to figure out what's going on here then. Could you try a full release + patch workflow and share the output of the following?

shorebird release ios-alpha -v
shorebird patch ios-alpha -v
shorebird preview -v

If this works, the output of preview should include logs saying that a new patch was installed, and upon relaunching the app, the patch should be what is running (you can change some of your flutter code between the release and patch steps to help confirm if you'd like).

Oladips commented 11 months ago

➜ apexnetwork-mobile.nosync git:(v3) ✗ shorebird preview -v [HTTP] GET https://api.shorebird.dev/api/v1/apps ✓ Fetching apps (0.7s) Which app would you like to preview? *** [HTTP] GET https://api.shorebird.dev/api/v1/apps/70f58f3e-115c-4732-9027-354319eb0a44/releases?sideloadable=true ✓ Fetching releases (0.4s) Which release would you like to preview? 3.1.6+1 ✓ Using production track (15ms) [Process.run] xcrun devicectl --version [Process.run] xcrun devicectl list devices --timeout 5 --json-output /var/folders/nh/jp5bsvys5z385hw19pnq0v8c0000gn/T/U92xXF/devicectl.out.json ✓ Locating device for run (0.1s) Using ios-deploy to install and launch. [Process.start] /Users/========/.shorebird/bin/cache/flutter/39df2792f537b1fc62a9c668a6990f585bd91456/bin/cache/artifacts/ios-deploy/ios-deploy --debug -r --bundle /Users/=========/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/ios_3.1.6+1.app [....] Waiting for iOS device to be connected ⠴ Starting app... (1.2s)[....] Using 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone'. ------ Uninstall phase ------ ⠋ Starting app... (2.4s)[ OK ] Uninstalled package with bundle id **** ⠙ Starting app... (2.5s)------ Install phase ------ ⠹ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠸ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠼ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠴ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠦ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠧ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠇ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠏ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠋ [ 0%] Found 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected th ⠹ [ 8%] Copying Frameworks/ZendeskSDKUIComponents.framework/Localizable/zh-Hans.lproj/Localizable.strings to device... (8. ⠋ [ 8%] Copying Frameworks/ZendeskSDKUIComponents.framework/Localizable/en-GB.lproj/Localizable.strings to device... (8.6s ⠋ [ 8%] Copying Frameworks/ZendeskSDKUIComponents.framework/Localizable/fr-CA.lproj/Localizable.strings to device... (8.6s ⠹ [ 8%] Copying Frameworks/ZendeskSDKUIComponents.framework/Localizable/zh-Hant.lproj/Localizable.strings to device... (8. ⠙ [ 9%] Copying Frameworks/ZendeskSDKUIComponents.framework/Localizable/pt-BR.lproj/Localizable.strings to device... (8.6s ⠼ [ 18%] Copying Frameworks/ZendeskSDKMessaging.framework/Localizable/zh-Hans.lproj/Localizable.strings to device... (17.8s ⠦ [ 19%] Copying Frameworks/ZendeskSDKMessaging.framework/Localizable/zh-Hant.lproj/Localizable.strings to device... (17.8s ⠦ [ 24%] Copying Frameworks/App.framework/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf to device... (2 ⠴ [ 27%] Copying Frameworks/App.framework/flutter_assets/assets/img/widgets/question-circle-outlined.png to device... (23.1 ⠏ [ 30%] Copying Frameworks/App.framework/flutter_assets/assets/img/onboarding/illustrationonboarding1.png to device... (24 ⠋ [ 30%] Copying Frameworks/App.framework/flutter_assets/assets/img/onboarding/illustrationonboarding1.png to device... (24 ⠙ [ 31%] Copying Frameworks/App.framework/flutter_assets/assets/img/onboarding/illustrationonboarding1.png to device... (24 ⠹ [ 31%] Copying Frameworks/App.framework/flutter_assets/assets/img/onboarding/illustrationonboarding1.png to device... (24 ⠼ [ 95%] GeneratingApplicationMap... (44.9s)[100%] InstallComplete ⠴ [ 95%] GeneratingApplicationMap... (46.6s)[100%] Installed package /Users/apexefemena/.shorebird/bin/cache/previews/70f58f3e-115c-4732-9027-354319eb0a44/ios_3.1.6+1.app ⠴ [ 95%] GeneratingApplicationMap... (47.4s)------ Debug phase ------ Starting debug of 00008020-00024DCC0C84003A (N841AP, iPhone XR, iphoneos, arm64e, 17.1.1, ) a.k.a. 'BTS’s iPhone' connected through WIFI... ⠋ [ 95%] GeneratingApplicationMap... (49.4s)2023-12-18 08:17:40.693 ios-deploy[12076:1860902] [ !! ] Unable to locate DeviceSupport directory with suffix 'DeveloperDiskImage.dmg'. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown! [ios-deploy] exited with code: 0

Hi @bryanoltman , I did all you said and this is the log. Rightly so it actually installed on my device and I manually open it but the patch changes did not take effect.

bryanoltman commented 11 months ago

Based on the logs, it looks like the install failed. Which version of Xcode are you using? Xcode 15 (the latest version) is required to develop with iOS 17 (which it looks like you're using).

Oladips commented 11 months ago

Yes I'm using xcode 15 and the latest os update on my phone iOS 17

bryanoltman commented 11 months ago

I think you've found a bug with our iOS preview logic. I can reproduce this if my device has wifi debugging enabled but is not unlocked. If you unlock your device, preview should work.

Once you've done this, can you try again?

bryanoltman commented 11 months ago

If this doesn't work, you may also try plugging your phone into your computer.

bryanoltman commented 11 months ago

Filed https://github.com/shorebirdtech/shorebird/issues/1583 to track the preview issue

bryanoltman commented 10 months ago

Closing now that we've got the other issue to track. Please reopen if unlocking/attaching your device doesn't fix the issue.