Browse Source

fix(cli): synchronize version with iOS Info.plist (#10944)

Lucas Fernandes Nogueira 10 months ago
parent
commit
a5848af65b
2 changed files with 12 additions and 0 deletions
  1. 6 0
      .changes/sync-ios-version.md
  2. 6 0
      crates/tauri-cli/src/mobile/ios/build.rs

+ 6 - 0
.changes/sync-ios-version.md

@@ -0,0 +1,6 @@
+---
+"tauri-cli": patch:bug
+"@tauri-apps/cli": patch:bug
+---
+
+Synchronize app version (`tauri.conf.json > version` or `Cargo.toml > package > version`) with the `CFBundleVersion` and `CFBundleShortVersionString` Info.plist values.

+ 6 - 0
crates/tauri-cli/src/mobile/ios/build.rs

@@ -174,6 +174,11 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
   )?;
   inject_resources(&config, tauri_config.lock().unwrap().as_ref().unwrap())?;
 
+  let mut plist = plist::Dictionary::new();
+  let version = interface.app_settings().get_package_settings().version;
+  plist.insert("CFBundleShortVersionString".into(), version.clone().into());
+  plist.insert("CFBundleVersion".into(), version.into());
+
   let info_plist_path = config
     .project_dir()
     .join(config.scheme())
@@ -182,6 +187,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
     info_plist_path.clone().into(),
     tauri_path.join("Info.plist").into(),
     tauri_path.join("Info.ios.plist").into(),
+    plist::Value::Dictionary(plist).into(),
   ])?;
   merged_info_plist.to_file_xml(&info_plist_path)?;