Skip to content

Conversation

@thymikee
Copy link
Contributor

@thymikee thymikee commented Jun 2, 2025

Summary

It's necessary to pass -sdk alongside singular -destination so that older Xcode versions can resolve the platform name properly. Otherwise it would use iphoneos instead of iphonesimulator and make the resulting app path incorrect.

Fixes #371

On top of that this PR improves the way running on iOS is handled when selecting --destination:

  • when it resolves to simulator, we calculate artifact name with simulator traits and only try to run on simulators
  • when it resolves to device, we calculate artifact name with device traits and only try to run on devices

Test plan

@vercel
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rnef ⬜️ Ignored (Inspect) Visit Preview Jun 3, 2025 10:38am

@thymikee thymikee requested a review from mdjastrzebski June 2, 2025 17:14
@thymikee thymikee force-pushed the fix/sdk-destination-device branch from 90e3a3d to 065e5cd Compare June 2, 2025 17:15
const artifactName = await formatArtifactName({
platform: 'ios',
traits: [
args.destination?.[0] ?? 'simulator',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was bug producing e.g. ios-generic/platform=iOS-Debug-{hash}, which would never resolve correctly for a remote artifact. cc @mdjastrzebski

Comment on lines 102 to 106
args: {
destination: [getGenericDestination(platformName, 'simulator')],
...args,
},
args,
destination: 'simulator',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mdjastrzebski instead of manipulating args, I'm passing the destination as a 'simulator' | 'device' here and further resolve the genericDestination and sdk from that

Comment on lines +152 to +161
if (device.type !== deviceOrSimulator) {
throw new RnefError(
`Selected device "${device.name}" is not a ${deviceOrSimulator}.
Please select available ${deviceOrSimulator} device:
${devices
.filter(({ type }) => type === deviceOrSimulator)
.map(({ name }) => `• ${name}`)
.join('\n')}`
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Comment on lines 194 to 218
function getSimulatorPlatformSDK(platform: ApplePlatform): PlatformSDK {
switch (platform) {
case 'ios':
return 'iphonesimulator';
case 'macos':
return 'macosx';
case 'tvos':
return 'appletvsimulator';
case 'visionos':
return 'xrsimulator';
}
}

function getDevicePlatformSDK(platform: ApplePlatform): PlatformSDK {
switch (platform) {
case 'ios':
return 'iphoneos';
case 'macos':
return 'macosx';
case 'tvos':
return 'appletvos';
case 'visionos':
return 'xr';
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

brought these back

reactNativePath: string;
artifactName: string;
binaryPath?: string;
destination: 'simulator' | 'device';
Copy link
Collaborator

Choose a reason for hiding this comment

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

typedef DestinationType = simu | device

@thymikee thymikee merged commit e2ddcde into main Jun 3, 2025
4 checks passed
@thymikee thymikee deleted the fix/sdk-destination-device branch June 3, 2025 10:41
@thymikee thymikee linked an issue Jun 3, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Build error when building framework for template demo app [iOS] Incorrect installation path

4 participants