Skip to content

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Feb 6, 2020

Description

Reland #49854. Ignore false positive "Preparing debugger support for iPhone" -10 error message since usually the app launches fine after giving that error.

Xcode ships with a command line tool called xcdevice that produces a json array of all available devices, including iOS devices that can be deployed via Xcode over the network (Connect via network checkbox). This PR filters out these network devices, but it's relevant to someday fixing #15072.

Screen Shot 2020-01-30 at 6 57 46 PM

I checked to make sure xcdevice is available in Xcode 10.2 (minimum Xcode required by Flutter) and later.

Example output:

{
  "simulator" : false,
  "operatingSystemVersion" : "13.3 (17C54)",
  "interface" : "usb",
  "available" : true,
  "platform" : "com.apple.platform.iphoneos",
  "modelCode" : "iPhone8,1",
  "identifier" : "d83d5bc53967baa0ee18626ba87b6254b2ab5418",
  "architecture" : "arm64",
  "modelName" : "iPhone 6s",
  "name" : "iPhone"
}

Since this provides the identifier, name, operating system, and architecture, we can get rid of all usages of idevice_id and ideviceinfo (cleanup happening in the next PR since this one was already getting too big).

Also, show any connection errors in doctor instead of crashing. Example:

[!] Connected device                          
    • Error: iPhone is not paired with your computer. To use iPhone with Xcode, unlock it and choose to trust this computer when prompted. (code -9)
  • Remove 2 libimobiledevice dependencies.
  • Remove all codepaths that resulted in cryptic lockdown errors and instead return Xcode's nice errors and recovery suggestions, like "To use iPhone with Xcode, unlock it and choose to trust this computer when prompted."

Related Issues

Part of #6118
Precursor to #15072 (will make networked devices discoverable when we stop filtering "network" interfaces).

Fixes #49375
Fixes #36524
Fixes #47727
Fixes #43398
Fixes #48057

Supersedes #49626
Supersedes #45657
Supersedes part of #36902?

Tests

xcode_test, devices_test

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@jmagman jmagman added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 6, 2020
@jmagman jmagman self-assigned this Feb 6, 2020
Comment on lines +332 to +339
final int code = _errorCode(errorProperties);

// Temporary error -10: iPhone is busy: Preparing debugger support for iPhone.
// Sometimes the app launch will fail on these devices until Xcode is done setting up the device.
// Other times this is a false positive and the app will successfully launch despite the error.
if (code != -10) {
continue;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the changed logic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the new logic have a test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though GitHub decided to collapse xcode_test.dart. See 'ignores "Preparing debugger support for iPhone" error'.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jmagman
Copy link
Member Author

jmagman commented Feb 6, 2020

Landed on red, fuchsia infra failure.

@duniapay
Copy link

running sudo pkill usbmuxd worked for me on Mac OSX

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

6 participants