diff --git a/.changes/improve-ios-sim.md b/.changes/improve-ios-sim.md new file mode 100644 index 000000000..4fcf758f2 --- /dev/null +++ b/.changes/improve-ios-sim.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:enhance +"@tauri-apps/cli": patch:enhance +--- + +Improve iOS simulator usage, checking if Xcode iOS SDK is installed and allowing usage of Simulator for older iOS releases (previously only supported when running on Xcode via `ios dev --open`). diff --git a/Cargo.lock b/Cargo.lock index e3fc631ad..a159e3fe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,9 +1062,9 @@ dependencies = [ [[package]] name = "cargo-mobile2" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b5acda005352ad50a3e58c8777781732d6ac1e8a82ab90d5ffd70b69c665f1" +checksum = "4957236e228c1014a3effe161d2320864c599e740414cdb3d1f98cf7427a1b08" dependencies = [ "colored", "core-foundation 0.10.0", @@ -1085,6 +1085,7 @@ dependencies = [ "os_info", "os_pipe", "path_abs", + "plist", "serde", "serde_json", "textwrap", diff --git a/crates/tauri-cli/Cargo.toml b/crates/tauri-cli/Cargo.toml index e5ca3c50b..77c2ebac2 100644 --- a/crates/tauri-cli/Cargo.toml +++ b/crates/tauri-cli/Cargo.toml @@ -36,7 +36,7 @@ name = "cargo-tauri" path = "src/main.rs" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies] -cargo-mobile2 = { version = "0.19", default-features = false } +cargo-mobile2 = { version = "0.20", default-features = false } [dependencies] jsonrpsee = { version = "0.24", features = ["server"] } diff --git a/crates/tauri-cli/src/mobile/ios/build.rs b/crates/tauri-cli/src/mobile/ios/build.rs index 6b641eba4..7766b2d00 100644 --- a/crates/tauri-cli/src/mobile/ios/build.rs +++ b/crates/tauri-cli/src/mobile/ios/build.rs @@ -327,7 +327,7 @@ fn run_build( .skip_codesign(); } - target.build(config, env, noise_level, profile, build_config)?; + target.build(None, config, env, noise_level, profile, build_config)?; let mut archive_config = ArchiveConfig::new(); if skip_signing { diff --git a/crates/tauri-cli/src/mobile/ios/dev.rs b/crates/tauri-cli/src/mobile/ios/dev.rs index 1fe890f6e..38569b814 100644 --- a/crates/tauri-cli/src/mobile/ios/dev.rs +++ b/crates/tauri-cli/src/mobile/ios/dev.rs @@ -25,7 +25,8 @@ use anyhow::Context; use cargo_mobile2::{ apple::{ config::Config as AppleConfig, - device::{Device, DeviceKind}, + device::{Device, DeviceKind, RunError}, + target::BuildError, }, env::Env, opts::{NoiseLevel, Profile}, @@ -283,24 +284,29 @@ fn run_dev( cli_options, )?; - if open { + let open_xcode = || { if !set_host { log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}"); } open_and_wait(config, &env) + }; + + if open { + open_xcode() } else if let Some(device) = &device { match run(device, options, config, noise_level, &env) { Ok(c) => Ok(Box::new(c) as Box), + Err(RunError::BuildFailed(BuildError::Sdk(sdk_err))) => { + log::warn!("{sdk_err}"); + open_xcode() + } Err(e) => { crate::dev::kill_before_dev_process(); - Err(e) + Err(e.into()) } } } else { - if !set_host { - log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}"); - } - open_and_wait(config, &env) + open_xcode() } }, ) @@ -312,7 +318,7 @@ fn run( config: &AppleConfig, noise_level: NoiseLevel, env: &Env, -) -> crate::Result { +) -> std::result::Result { let profile = if options.debug { Profile::Debug } else { @@ -328,5 +334,4 @@ fn run( profile, ) .map(DevChild::new) - .map_err(Into::into) }