Skip to content

Conversation

vashworth
Copy link
Contributor

@vashworth vashworth commented Aug 3, 2023

This PR includes the following changes. These changes only apply to iOS 17 physical devices.

Command Change Description Changes to User Experience
flutter run --release Uses devicectl to install and launch application in release mode. No change.
flutter run Uses Xcode via automation scripting to run application in debug and profile mode. Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal.
flutter run --use-application-binary=xxxx Creates temporary empty Xcode project and use Xcode to run via automation scripting in debug and profile. Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal.
flutter install Uses devicectl to check installed apps, install app, uninstall app. No change.
flutter screenshot Will return error. Will return error.

Other changes include:

  • Using devicectl to get information about the device
  • Using idevicesyslog and Dart VM logging for device logs

Note:
Xcode automation scripting (used in flutter run for debug and profile) does not work in a headless (without a UI) interface. No known workaround.

Fixes #128827, #128531.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Aug 3, 2023
@vashworth vashworth marked this pull request as draft August 3, 2023 16:58
@vashworth vashworth changed the title [WIP] Xcode debug and devicectl workflow New tooling for iOS 17 physical devices Aug 4, 2023
@vashworth vashworth marked this pull request as ready for review August 4, 2023 18:50
@vashworth
Copy link
Contributor Author

@hellohuanlin Did you upgrade a physical device to iOS 17? Could be good to have the workflows tested on another real device other than just mine.

@vashworth
Copy link
Contributor Author

@christopherfujino @hellohuanlin There is JavaScript in this PR, if neither of you are comfortable reviewing JS, do you know someone who would be? Perhaps someone on the web team?

@christopherfujino
Copy link
Contributor

Woohoo, nice! I'll try to test this out with my mac.

@vashworth
Copy link
Contributor Author

vashworth commented Aug 4, 2023

Woohoo, nice! I'll try to test this out with my mac.

@christopherfujino That'd be great! If you don't want to upgrade a device to iOS 17, you can test at least the Xcode workflows using an environment variable to force it.
Example:

The devicectl workflows only work with physical iOS 17 devices alongside Xcode 15.

@christopherfujino
Copy link
Contributor

@christopherfujino @hellohuanlin There is JavaScript in this PR, if neither of you are comfortable reviewing JS, do you know someone who would be? Perhaps someone on the web team?

This is fine (I'd much rather review JS than applescript :) )

@christopherfujino
Copy link
Contributor

So I tested flutter run --debug on a physical iphone and it worked! For reference, I hit the following dialogs on my host macbook:

Screenshot 2023-08-04 at 3 15 43 PM

Where Alacritty is my terminal application. I'm not sure whether or not this will alarm users. For CLI usage, we could print to the terminal that they may see this prompt, but that won't help IDE users.

@christopherfujino
Copy link
Contributor

I tried flutter install -d physicaliPhone which succeeded. Confusingly, even invoking flutter install --release apparently installed the debug version, and I had to explicitly first do flutter build ios --release for flutter install to install a release mode app I could launch from the home screen, but this seems like an unrelated bug.

@christopherfujino
Copy link
Contributor

flutter run --release -d iPhone works.

@christopherfujino
Copy link
Contributor

christopherfujino commented Aug 4, 2023

When I do:

flutter build ipa
flutter run -d iPhone --use-application-binary=./build/ios/ipa/delete_me_flutter.ipa

I get:
Screenshot 2023-08-04 at 4 05 43 PM

Is this user error?

I think I have codesigning configured correctly, since I can do flutter run --release -d iPhone.

@vashworth
Copy link
Contributor Author

When I do:

flutter build ipa
flutter run -d iPhone --use-application-binary=./build/ios/ipa/delete_me_flutter.ipa

I get: Screenshot 2023-08-04 at 4 05 43 PM

Is this user error?

I think I have codesigning configured correctly, since I can do flutter run --release -d iPhone.

So this I believe is user error. I got the same thing, but I also got the same thing with Xcode 14 and iOS 16. I think perhaps our developer account don't have the proper permissions -- unsure. Anyways, I think it's a non issue. I tested it by doing flutter build ios and using --use-application-binary=./build/ios/iphoneos/Runner.app. Also, I believe @chingjun doesn't have this issue with g3.

@vashworth
Copy link
Contributor Author

I tried flutter install -d physicaliPhone which succeeded. Confusingly, even invoking flutter install --release apparently installed the debug version, and I had to explicitly first do flutter build ios --release for flutter install to install a release mode app I could launch from the home screen, but this seems like an unrelated bug.

Yeah flutter install doesn't build, it just installs whatever is already in the build folder. For example, if you do flutter clean and then flutter install, it'll fail because there's nothing in the build folder.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 10, 2023
vashworth added a commit to vashworth/flutter that referenced this pull request Aug 11, 2023
This PR includes the following changes. These changes only apply to iOS 17 physical devices.

| Command | Change Description  | Changes to User Experience |
| ------------- | ------------- | ------------- |
| `flutter run --release` | Uses `devicectl` to install and launch application in release mode.  | No change.  |
| `flutter run`  | Uses Xcode via automation scripting to run application in debug and profile mode. | Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal. |
| `flutter run --use-application-binary=xxxx` | Creates temporary empty Xcode project and use Xcode to run via automation scripting in debug and profile. | Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal.  |
| `flutter install` | Uses `devicectl` to check installed apps, install app, uninstall app.  | No change.  |
| `flutter screenshot` | Will return error.  | Will return error.  |

Other changes include:
* Using `devicectl` to get information about the device
* Using `idevicesyslog` and Dart VM logging for device logs

Note:
Xcode automation scripting (used in `flutter run` for debug and profile) does not work in a headless (without a UI) interface. No known workaround.

Fixes flutter#128827, flutter#128531.
auto-submit bot pushed a commit that referenced this pull request Aug 14, 2023
Fixes a couple of issues introduced in new iOS 17 physical device tooling: #131865.

1) Duplicate messages were being filtered out too aggressively. 

For example, if on the counter app, you printed "Increment!" on button click, it would only print once no matter how many times you clicked.

Sometimes more than one log source is used at a time and the original intention was to filter duplicates between two log sources, so it wouldn't print the same message from both logs. However, it would also filter when the same message was added more than once via the same log.

The new solution distinguishes a "primary" and a "fallback" log source and prefers to use the primary source unless it's not working, in which it'll use the fallback. If the fallback is faster than the primary, the primary will exclude the logs received by the fallback in a 1-to-1 fashion to prevent too-aggressive filtering. Once a flutter-message has been received by the primary source, fallback messages will be ignored.

Note: iOS < 17 did not regress.

2) There was a race condition between the shutdown hooks and exiting XcodeDebug that was causing a crash when deleting a file that doesn't exist. This only affects CI  - for the new integration tests and when testing with iOS 17 physical devices.
vashworth added a commit to vashworth/flutter that referenced this pull request Aug 14, 2023
…32491)

Fixes a couple of issues introduced in new iOS 17 physical device tooling: flutter#131865.

1) Duplicate messages were being filtered out too aggressively. 

For example, if on the counter app, you printed "Increment!" on button click, it would only print once no matter how many times you clicked.

Sometimes more than one log source is used at a time and the original intention was to filter duplicates between two log sources, so it wouldn't print the same message from both logs. However, it would also filter when the same message was added more than once via the same log.

The new solution distinguishes a "primary" and a "fallback" log source and prefers to use the primary source unless it's not working, in which it'll use the fallback. If the fallback is faster than the primary, the primary will exclude the logs received by the fallback in a 1-to-1 fashion to prevent too-aggressive filtering. Once a flutter-message has been received by the primary source, fallback messages will be ignored.

Note: iOS < 17 did not regress.

2) There was a race condition between the shutdown hooks and exiting XcodeDebug that was causing a crash when deleting a file that doesn't exist. This only affects CI  - for the new integration tests and when testing with iOS 17 physical devices.
vashworth added a commit to vashworth/flutter that referenced this pull request Aug 14, 2023
…32491)

Fixes a couple of issues introduced in new iOS 17 physical device tooling: flutter#131865.

1) Duplicate messages were being filtered out too aggressively. 

For example, if on the counter app, you printed "Increment!" on button click, it would only print once no matter how many times you clicked.

Sometimes more than one log source is used at a time and the original intention was to filter duplicates between two log sources, so it wouldn't print the same message from both logs. However, it would also filter when the same message was added more than once via the same log.

The new solution distinguishes a "primary" and a "fallback" log source and prefers to use the primary source unless it's not working, in which it'll use the fallback. If the fallback is faster than the primary, the primary will exclude the logs received by the fallback in a 1-to-1 fashion to prevent too-aggressive filtering. Once a flutter-message has been received by the primary source, fallback messages will be ignored.

Note: iOS < 17 did not regress.

2) There was a race condition between the shutdown hooks and exiting XcodeDebug that was causing a crash when deleting a file that doesn't exist. This only affects CI  - for the new integration tests and when testing with iOS 17 physical devices.
vashworth added a commit to vashworth/flutter that referenced this pull request Aug 14, 2023
…32491)

Fixes a couple of issues introduced in new iOS 17 physical device tooling: flutter#131865.

1) Duplicate messages were being filtered out too aggressively. 

For example, if on the counter app, you printed "Increment!" on button click, it would only print once no matter how many times you clicked.

Sometimes more than one log source is used at a time and the original intention was to filter duplicates between two log sources, so it wouldn't print the same message from both logs. However, it would also filter when the same message was added more than once via the same log.

The new solution distinguishes a "primary" and a "fallback" log source and prefers to use the primary source unless it's not working, in which it'll use the fallback. If the fallback is faster than the primary, the primary will exclude the logs received by the fallback in a 1-to-1 fashion to prevent too-aggressive filtering. Once a flutter-message has been received by the primary source, fallback messages will be ignored.

Note: iOS < 17 did not regress.

2) There was a race condition between the shutdown hooks and exiting XcodeDebug that was causing a crash when deleting a file that doesn't exist. This only affects CI  - for the new integration tests and when testing with iOS 17 physical devices.
auto-submit bot pushed a commit that referenced this pull request Aug 14, 2023
Two CP commits in a single PR.

Original PRs: 
#131865
#132491
auto-submit bot pushed a commit that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
FlutterSu pushed a commit to flutter-rosita/flutter-rosita that referenced this pull request Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flutter cannot identify iOS 17 devices as wireless
4 participants