Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,17 @@ const createRun =
}

if (args.udid) {
const device = devices.find((d) => d.udid === args.udid);
let device = devices.find((d) => d.udid === args.udid);
if (!device) {
return logger.error(
// We may be able to recover from this for macCatalyst app starts,
// but the general case is this is a problem and device list will help
logger.warn(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no return, and warn not error now as we may recover from this for macCatalyst with this patch
but still print the device list because that should help the general case where this was an incorrectly specified UDID

`Could not find a device with udid: "${chalk.bold(
args.udid,
)}". ${printFoundDevices(devices)}`,
);
}
if (device.type === 'simulator') {
if (device?.type === 'simulator') {
return runOnSimulator(
xcodeProject,
platformName,
Expand All @@ -328,6 +330,20 @@ const createRun =
fallbackSimulator,
);
} else {
if (!device) {
// On arm64 machines, the catalyst UDID returned by 'xcrun xctrace list devices' is not correct
// xcodebuild will return an error indicating the UDID is unknown and offering a different one
// you may obtain it by running xcodebuild with the UDID you think works then parse out the other one from the returned error:
// CATALYST_DESTINATION=$(xcodebuild -workspace ios/rnfbdemo.xcworkspace -configuration Debug -scheme rnfbdemo -destination id=7153382A-C92B-5798-BEA3-D82D195F25F8 2>&1|grep macOS|grep Catalyst|head -1 |cut -d':' -f5 |cut -d' ' -f1)
//
// How to handle the incorrect catalyst UDID?
// Assume if a UDID is specified, the user knows what they are doing.
// Use the given UDID and force the type, so "catalyst" will launch the app correctly
device = {name: 'unknown', udid: args.udid, type: 'catalyst'};
logger.warn(
'Running with provided udid anyway, and type "catalyst". \'xcodebuild\' command may return error.',
);
}
return runOnDevice(
device,
platformName,
Expand Down
Loading