Skip to content

Fix iOS target architecture detection for Intel Macs #3969

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luapmartin
Copy link

@luapmartin luapmartin commented Apr 8, 2025

Fix iOS Target Architecture Detection for Intel Macs

Problem

When building a Dioxus app for iOS simulator on an Intel-based Mac, the Dioxus CLI (dx) ignores the specified target architecture (x86_64-apple-ios) and always builds for aarch64-apple-ios-sim. This results in an app that cannot run on Intel-based iOS simulators, showing the error "This app needs to be updated by the developer to work on this version of iOS." (see #3962)

Solution

This PR adds host architecture detection to the Dioxus CLI and updates the iOS target selection logic to:

  1. First check if a target was explicitly specified via the --target flag
  2. If no target was specified, detect the host architecture and use the appropriate target:
    • x86_64-apple-ios for Intel Macs
    • aarch64-apple-ios-sim for Apple Silicon Macs

Changes

  • Added a detect_host_arch() function to detect if the host is running on Apple Silicon or Intel
  • Updated the iOS target selection logic in build/request.rs
  • Fixed the iOS bundle target selection in cli/bundle.rs
  • Enhanced the iOS tooling verification in build/verify.rs
  • Added a has_target method to check if a specific target is installed

Testing

Tested on an Intel-based Mac by:

  1. Building a test iOS project with the modified CLI
  2. Verifying that it correctly detects the Intel Mac architecture and uses the x86_64-apple-ios target
  3. Verifying that it correctly respects explicitly specified targets

@luapmartin luapmartin requested a review from a team as a code owner April 8, 2025 08:14
@luapmartin luapmartin force-pushed the fix-ios-intel-target branch from 6ca9905 to 50bcfb4 Compare April 8, 2025 08:28
@luapmartin luapmartin force-pushed the fix-ios-intel-target branch from 50bcfb4 to 4eff26d Compare April 8, 2025 08:34
@ealmloff ealmloff added bug Something isn't working cli Related to the dioxus-cli program mobile Mobile renderer labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program mobile Mobile renderer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants