Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added UDID to the simulator identifier in react-native run-ios #5978

Closed
wants to merge 3 commits into from
Closed

Added UDID to the simulator identifier in react-native run-ios #5978

wants to merge 3 commits into from

Conversation

icodethings
Copy link

Added in the UUID to the simulatorFullName that is passed to xcrun instruments -w.

If you have an simulator setup with an Apple Watch, just trying to launch a simulator like iPhone 6 (9.2) will cause a Instruments Usage Error : Ambiguous device name/identifier error because there could another simulator called iPhone 6 (9.2) + Apple Watch ...

Another alternative is to just pass the UUID to the -w flag.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @frantic to be a potential reviewer.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

@icodethings updated the pull request.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 17, 2016
@icodethings icodethings changed the title Added UUID to the simulator identifier in react-native run-ios Added UDID to the simulator identifier in react-native run-ios Feb 17, 2016
@facebook-github-bot
Copy link
Contributor

@icodethings updated the pull request.

@grabbou
Copy link
Contributor

grabbou commented Feb 18, 2016

I think it also happens to me, iPhone 6s is not starting, but 6 is. No error logged, so it definitely falls under the same empty catch.

@facebook-github-bot
Copy link
Contributor

@icodethings updated the pull request.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@icodethings updated the pull request.

@icodethings
Copy link
Author

I've updated it to just pass the UDID, without the rest of the simulator name and version.

I'm pretty sure that's the best bet on reducing risk of any Ambiguous device name/identifier errors.

@@ -52,10 +52,10 @@ function _runIOS(argv, config, resolve, reject) {
throw new Error(`Cound't find ${args.simulator} simulator`);
}

const simulatorFullName = `${selectedSimulator.name} (${selectedSimulator.version})`;
const simulatorFullName = `${selectedSimulator.name} (${selectedSimulator.version}) [${selectedSimulator.udid}]`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we then remove the udid from fullName then? I think that's more than we need to print on line 56

Copy link
Author

Choose a reason for hiding this comment

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

@grabbou I was going to do that, but I was thinking about leaving it in there to make sure people can identify exactly what simulator is launched. Just incase you have, let's say, two iPhone 6 (iOS 9.2) setup.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true, but on the other hand - since we launch simulators based on the string (name), not its udid, I am not sure if it helps that much on regular basis. If you have say naming conflict, I am pretty sure the first device from the list will get selected.

@mkonicek
Copy link
Contributor

Can udid ever be empty? How have you tested the code works? Have you tested both with a simulator and a device?

@mkonicek
Copy link
Contributor

Please rebase (This branch is out-of-date with the base branch).

Added in the UDID to the `simulatorFullName` that is passed to `xcrun instruments -w`.

If you have an simulator setup with an Apple Watch, just trying to launch a simulator like "iPhone 6 (9.2)" will cause a "Instruments Usage Error : Ambiguous device name/identifier" error because there is another simulator called "iPhone 6 (9.2) + Apple Watch"
Launching the simulator with just the UDID of the found simulator.

This prevents any `Instruments Usage Error : Ambiguous device name/identifier` errors if someone has the same name on simulators with different iOS versions or an Apple Watch.
@icodethings
Copy link
Author

I can't find a scenario where UDID will be empty. If the xcrun simctl list devices were to ever return an odd string that matched the regex, it may be possible.
The run-ios command can't run on a device - just a simulator. This is something that could be useful to add later.

I've tested this with a range of different simulator setups and I can't find a scenario that breaks it.

@icodethings
Copy link
Author

I think I've figured out a more reliable way of doing this that can remove the need to rely on the regex parsing.

I'll close of this PR and start another one soon.

@icodethings
Copy link
Author

I've closed off this PR and created a new one with, what I think, is a much better way of solving this problem (and more).

#6043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants