dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Dioxus iOS Build Issue on Intel Mac

Open luapmartin opened this issue 1 year ago • 0 comments

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."

Steps To Reproduce

Steps to reproduce the behavior:

  1. have an old Intel-Mac
  2. Create a new Dioxus project or use an existing one
  3. Configure iOS settings in Dioxus.toml and Cargo.toml
  4. Run dx serve --platform ios --verbose or dx serve --platform ios --target x86_64-apple-ios --verbose
  5. Observe in the verbose output that it's using aarch64-apple-ios-sim regardless of the specified target
  6. When the app is installed on the simulator, it shows the error "This app needs to be updated by the developer to work on this version of iOS"

Expected behavior

The Dioxus CLI should detect the host architecture (Intel vs Apple Silicon) and use the appropriate target architecture (x86_64-apple-ios for Intel Macs). The app should build correctly for the Intel architecture and run on the iOS simulator without compatibility warnings.

Screenshots

N/A

Environment:

  • Dioxus CLI version: 0.6.3
  • Rust version: 1.85.1
  • OS info: macOS 15.4 (Intel-based, Xcode 16.3)
  • iOS Simulator version: iOS 16.4 and iOS 18.4 (both exhibit the same issue)
  • App platform: iOS
  • Device: iPhone 14 and 16 Pro simulator

Workaround

A manual workaround is to:

  1. Build the app directly with cargo: cargo build --target x86_64-apple-ios --features mobile
  2. Create an iOS app bundle manually with the correct Info.plist and assets
  3. Install the app on the simulator using xcrun simctl install

Questionnaire

I'm interested in fixing this myself but don't know where to start.

Additional Information

The issue appears to be in the Dioxus CLI's build system, which is hardcoding the target architecture to aarch64-apple-ios-sim regardless of the specified target. This can be seen in the verbose output of the build process when running either dx serve --platform ios --verbose or dx serve --platform ios --target x86_64-apple-ios --verbose:

17:29:05 [dev] cargo args: ["--target", "aarch64-apple-ios-sim", "--verbose", "--features", "mobile", "--bin", "rusty"]

The error message when trying to install the app confirms the architecture mismatch:

An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=4):
App installation failed: "Rusty" Needs To Be Updated
This app needs to be updated by the developer to work on this version of iOS.
Failed to find matching arch for input file: /Users/username/Library/Developer/CoreSimulator/Devices/5A41XXXXXXXFBBA7/data/Library/Caches/com.apple.mobile.installd.staging/temp.WXXX7A/extracted/Rusty.app/rusty

The Dioxus documentation at https://dioxuslabs.com/learn/0.6/guides/mobile/#ios mentions Apple Silicon Macs but doesn't provide specific instructions for Intel-based Macs:

> If you are using M1, you will have to run `cargo build --target x86_64-apple-ios` instead of `cargo apple build` if you want to run in simulator.

This note suggests that there should be special handling for different Mac architectures, but the CLI doesn't seem to implement this detection and always defaults to the Apple Silicon target.

According to the official Rust documentation (https://doc.rust-lang.org/rustc/platform-support/apple-ios.html), both architectures are supported as Tier 2 targets:

*-apple-ios

Apple iOS / iPadOS targets.

Tier: 2 (without Host Tools)

* `aarch64-apple-ios`: Apple iOS on ARM64.
* `aarch64-apple-ios-sim`: Apple iOS Simulator on ARM64.
* `x86_64-apple-ios`: Apple iOS Simulator on 64-bit x86.

The Dioxus CLI should detect the host architecture and use the appropriate target (x86_64-apple-ios for Intel Macs and aarch64-apple-ios-sim for Apple Silicon Macs).

luapmartin avatar Apr 07 '25 16:04 luapmartin