Run a virtual iPhone on an Apple Silicon Mac.
Swift
Make host location sync a machine setting that actually reaches the guest
Jackyc96decf208eb
diff --git a/Documents/Downloads/README.md b/Documents/Downloads/README.mdindex e909f18c..8c53cf05 100644--- a/Documents/Downloads/README.md+++ b/Documents/Downloads/README.md@@ -31,6 +31,7 @@ Use a `VPhone.bundle` from the same series as Launchpad. The series is the first| Launchpad | VPhone.bundle || --- | --- |+| 2.8.x | 2.8.x || 2.7.x | 2.7.x || 2.6.x | 2.6.x || 2.5.x | 2.5.x |diff --git a/Research/Guest/location_simulation_26_4_failure.md b/Research/Guest/location_simulation_26_4_failure.mdindex b12aecaa..4b6b50d5 100644--- a/Research/Guest/location_simulation_26_4_failure.md+++ b/Research/Guest/location_simulation_26_4_failure.md@@ -13,6 +13,53 @@> identity rewrites off; only the camera patches remain from EXP. Re-run the> reproduction below on a VM restored with `standard` to confirm.+## Host location never reached the guest (2026-10-07)++Every VM log that recorded Sync Host Location had the host working and the+guest refusing: VPhoneLocation.app was authorized and wrote fixes, vphone-vm+forwarded them, and every `location.set` failed with `Location Services are+turned off` (issue596-ip18, unlocktest-iphone, nettest-01, discard-a/b). vphone-vm+only printed the error and the menu checkmark stayed on. Three separate causes+turned up on new `standard` iPhone17,3 iOS 27.0 (24A435) VMs.++**The guest's Location Services switch is off.** Setup Assistant's Location+Services pane turns it on, so a guest whose Setup Assistant was skipped, or not+yet finished, has it off and locationd gives no client a location, a simulated+one included. vphoned leaves the switch alone: `location.set` and+`location.current` now fail with the code `location_services_off`, the VM+window says so once, and vphone-vm offers the last Mac fix again every 10 s.+Turning the switch on in the guest's Settings brought the Mac's coordinate in+6 s later with the Mac standing still (`fresh` and `simulated` true), and Maps+drew its blue dot there. Turning the switch on from vphoned works too+(`+[CLLocationManager setLocationServicesEnabled:]` with+`com.apple.locationd.authorizeapplications`, verified on 2026-10-07) but was+left out: the switch is the guest user's.++**The Mac's locationd turned the helper away.** It keys VPhoneLocation.app by+bundle identifier and stores the code requirement the first client registered+with; an ad hoc signature's implicit requirement is its cdhash. While a helper+with the stored requirement runs, a helper from another build is refused+silently (`#registration stored requirement is not equal to this new+requirement`, then `#registration can't continue`) and never gets an+authorization status, so it sends nothing. Two machines on different bundles+could not both sync, and a helper of a new build was refused as long as an old+one ran. StageBundle.sh now signs the helper with `designated => identifier+"com.vphone.bundle.location"`; locationd accepted that requirement once no+cdhash-signed helper was running, and the helper went from `NotDetermined` to+`AuthorizedAlways` without a prompt.++**locationd deadlocks in a headless guest.** Started with `--headless`, the VM's+locationd deadlocked within a second of starting on every boot, with sync off+and no location request sent; with a window it never did. A spindump has its+`CLClientManagerSilo` and `CLAuthSyncManagerSilo` queues "blocked by queue in a+transient state" and every client (vphoned, Maps, navd, nearbyd) waiting on+`com.apple.locationd.synchronous`. Location RPCs then time out after 120 s. Not+solved here.++Sync Host Location is now a machine setting, `syncsHostLocation` in+`config.plist`, off when absent, in a window and headless alike (headless used+to start it unconditionally).+## Reproduction (2026-09-25)The running `26.4` VM uses the `jb` firmware variant and iOS 26.4.0. Itsdiff --git a/Research/vphoned_http_api.md b/Research/vphoned_http_api.mdindex 41648d96..373c0f99 100644--- a/Research/vphoned_http_api.md+++ b/Research/vphoned_http_api.md@@ -339,6 +339,16 @@ so the host tells a start (guest boot, userspace reboot, a vphoned update) froma probe it lost and found again; only a new instance is unlocked. A guest stillin Setup Assistant is left alone.+A machine with `syncsHostLocation` in its `config.plist` (`vphone-cli vm config+<name> --sync-host-location on`, Location > Sync Host Location in the VM window,+or the Location section of a machine's Settings in Launchpad) has `vphone-vm`+send each fix of the Mac's location as `location.set` while vphoned is+connected. Absent means off, in a window and headless alike. When the guest+answers `location_services_off`, the window says so once, and `vphone-vm`+offers the last fix again every 10 s until the guest takes it, since the Mac+sends a new one only when it moves. A preset or a replay pauses sync for that+run without changing the setting.+`time.timezone` (capability `timezone`; REST `GET/PUT /v1/timezone`) returns`{identifier, automatic, seconds_from_gmt}`: the Olson name`/var/db/timezone/localtime` points to under `/var/db/timezone/zoneinfo`, and@@ -523,7 +533,15 @@ switching back needs trusting again too. The VM window's Device › Set UDID…accepts only 8 and 16 hex digits joined by a hyphen (sent upper-case) or 40 hexdigits (sent lower-case).-`location.set` is IcliKit's `simulateLocation`: it sends locationd's+`location.set` and `location.current` first check+`CLLocationManager.locationServicesEnabled()`. With the guest's Location+Services switch off they fail with the code `location_services_off`, since+locationd then gives no client a location, the simulated one included. The+switch is turned on by Setup Assistant's Location Services pane, so a guest+whose Setup Assistant was skipped has it off. vphoned never changes the switch;+it belongs to the guest's Settings > Privacy & Security > Location Services.++Past that check, `location.set` is IcliKit's `simulateLocation`: it sends locationd's`CLSimulationManager` the sequence Xcode uses (`stopLocationSimulation`,`clearSimulatedLocations`, `appendSimulatedLocation:`, `flush`,`startLocationSimulation`). locationd sends no reply and silently ignores adiff --git a/Skills/vphone-guest-control/references/rpc-methods.md b/Skills/vphone-guest-control/references/rpc-methods.mdindex 81afec13..293a0abb 100644--- a/Skills/vphone-guest-control/references/rpc-methods.md+++ b/Skills/vphone-guest-control/references/rpc-methods.md@@ -182,7 +182,7 @@ size problem.| `settings.set` | `domain`, `key`, `value`, `type?` || `settings.delete` | `domain`, `key` || `clipboard.get` / `set` / `clear` | `set` takes `text` |-| `location.set` / `clear` / `current` | `set` takes latitude/longitude; read-back can fail on some guests |+| `location.set` / `clear` / `current` | `set` takes latitude/longitude; `set` and `current` fail with `location_services_off` while the guest's Location Services switch is off (vphoned never turns it on); read-back can fail on some guests || `time.timezone` | none reads `{identifier, automatic, seconds_from_gmt}`; `identifier` (Olson name) pins the zone and turns automatic off; `automatic: true` hands it back to timed. The VM sends the Mac's zone on every connect || `notify.post` / `notify.state` | `name`, `state?` || `keychain.*` | Lists, adds and edits secrets; use only on request and never print values |diff --git a/VPhoneDaemon/Daemon/GuestAPI.swift b/VPhoneDaemon/Daemon/GuestAPI.swiftindex b68eb125..034bc41c 100644--- a/VPhoneDaemon/Daemon/GuestAPI.swift+++ b/VPhoneDaemon/Daemon/GuestAPI.swift@@ -1,3 +1,4 @@+import CoreLocationimport CryptoKitimport Darwinimport Foundation@@ -13,12 +14,17 @@ enum GuestAPIError: Error, CustomStringConvertible {/// The request would repeat work the guest has already done. The code is/// sent as the error code so a client can tell it apart from a failure.case alreadyDone(code: String, message: String)+ /// The guest's Location Services switch is off, so locationd gives no+ /// client a location. vphoned leaves the switch to the guest's Settings.+ case locationServicesOffvar description: String {switch self {case let .invalidRequest(message), let .operationFailed(message): messagecase let .unsupportedMethod(method): "Unknown method: \(method)"case let .alreadyDone(_, message): message+ case .locationServicesOff:+ "Location Services are turned off in the guest. Turn them on in Settings > Privacy & Security > Location Services."}}@@ -26,6 +32,9 @@ enum GuestAPIError: Error, CustomStringConvertible {if case let .alreadyDone(code, _) = self {return code}+ if case .locationServicesOff = self {+ return "location_services_off"+ }return "invalid_operation"}}@@ -318,6 +327,7 @@ enum GuestAPI {}return try hidPress(page: page, usage: usage)case "location.set":+ guard CLLocationManager.locationServicesEnabled() else { throw GuestAPIError.locationServicesOff }return try simulateLocation(latitude: number(params, "latitude"),longitude: number(params, "longitude"),@@ -330,6 +340,7 @@ enum GuestAPI {case "location.clear":return try clearSimulatedLocation()case "location.current":+ guard CLLocationManager.locationServicesEnabled() else { throw GuestAPIError.locationServicesOff }return try currentLocation(timeout: number(params, "timeout", default: 10))case "developer_mode.status":return try developerModeStatus()diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineCommand.swiftindex ddcec0a7..f799532d 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineCommand.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/VirtualMachine/VPhoneVirtualMachineCommand.swift@@ -160,6 +160,7 @@ struct VPhoneVirtualMachineInfoCommand: ParsableCommand {print("disk: \(report.diskSizeBytes) bytes")print("net: \(describeNetwork(report.network))")print("unlock: \(report.unlocksAtStartup ? "on" : "off")")+ print("location: \(report.syncsHostLocation ? "on" : "off")")if let snapshots = try? VPhoneMachineSnapshots.list(of: bundle), !snapshots.isEmpty {print("snapshots: \(snapshots.count)")}@@ -237,6 +238,11 @@ struct VPhoneVirtualMachineConfigCommand: ParsableCommand {--unlock-at-startup on has vphone-vm wake the guest and dismiss its Lock Screen each time \vphoned starts in it: after the VM starts and after the guest reboots. Applies from the \next connect.++ --sync-host-location on has vphone-vm forward this Mac's location to the guest while it \+ runs, as a simulated location; macOS asks once for permission. The guest's own Location \+ Services switch is left alone: with it off, apps in the guest get no location. Applies \+ from the next start; in a VM window, Location > Sync Host Location changes it at once.""",)@@ -267,11 +273,14 @@ struct VPhoneVirtualMachineConfigCommand: ParsableCommand {var macName: String?@Option(name: .long, help: "Unlock the guest when it starts: on | off (default)")var unlockAtStartup: String?+ @Option(name: .long, help: "Forward this Mac's location to the guest: on | off (default)")+ var syncHostLocation: String?func run() throws {let name = try VPhoneVirtualMachineSelection.resolveExisting(name, in: lib.library)let edit = try networkEdit(vmName: name)let unlocks = try unlockAtStartup.map { try Self.parseSwitch($0, option: "--unlock-at-startup") }+ let syncsLocation = try syncHostLocation.map { try Self.parseSwitch($0, option: "--sync-host-location") }let updated = try VPhoneBundleOperations.updateConfig(bundleNamed: name,in: lib.library,@@ -279,6 +288,7 @@ struct VPhoneVirtualMachineConfigCommand: ParsableCommand {memoryMB: memory,networkEdit: edit,unlocksAtStartup: unlocks,+ syncsHostLocation: syncsLocation,)let m = updated.manifestprint(diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.shindex ad3b04a4..f07e7cb6 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh@@ -139,7 +139,15 @@ compatibility_library="$(/usr/bin/xcrun swift-stdlib-tool --print \/usr/bin/codesign --force --sign - "$macos/vphone-escalator"/usr/bin/codesign --force --sign - "$macos/libswiftCompatibilitySpan.vphone.dylib"/usr/bin/codesign --force --sign - --entitlements "$root/VPhoneExecutable/VPhoneVirtualization/Resources/VPhoneVirtualization.entitlements" "$macos/vphone-vm"-/usr/bin/codesign --force --sign - "$location_app"+# locationd keeps the requirement a client first registered with and turns+# away a client with another one while that one still runs. An ad hoc+# signature's implicit requirement is its cdhash, so each build would be a+# new app: after an update the grant is lost, and two machines on different+# bundles cannot both read the Mac's location. Every build names the helper by+# identifier instead. That lends nothing new: the helper already hands the+# location to whatever starts it.+/usr/bin/codesign --force --sign - \+ --requirements '=designated => identifier "com.vphone.bundle.location"' "$location_app"/usr/bin/codesign --force --sign - "$bundle""${0:a:h}/ValidateBundle.sh" "$bundle"diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.shindex d34f369f..910266b3 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/ValidateBundle.sh@@ -44,6 +44,12 @@ donerequire_signed_macho "$frameworks/VPhonePatchKit.framework/Versions/A/VPhonePatchKit"require_signed_macho "$location_helper"/usr/bin/codesign --verify --strict "$location_app"+# One requirement for every build, so locationd keeps one grant for all of+# them (see StageBundle.sh).+[[ "$(/usr/bin/codesign -d -r- "$location_app" 2>/dev/null)" == *'designated => identifier "com.vphone.bundle.location"' ]] || {+ print -u2 "VPhoneLocation.app does not carry its identifier requirement"+ exit 1+}# locationd answers only a client inside an .app, and prompts with its usage# description in the user's language.[[ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundlePackageType' "$location_app/Contents/Info.plist")" == "APPL" ]] || {diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plistindex 45c40c7c..6e30381f 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist@@ -11,7 +11,7 @@<key>CFBundleVersion</key><string>34</string><key>CFBundleShortVersionString</key>- <string>2.7.0</string>+ <string>2.8.0</string><key>NSMicrophoneUsageDescription</key><string>Shares this Mac's microphone with the virtual iPhone so apps running inside it can record.</string></dict>diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/Localizable.xcstrings b/VPhoneExecutable/VPhoneVirtualization/Resources/Localizable.xcstringsindex fa8a4761..1133a84a 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/Localizable.xcstrings+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/Localizable.xcstrings@@ -242,6 +242,111 @@}}},+ "Unable to Change Sync Host Location" : {+ "extractionState" : "manual",+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Unable to Change Sync Host Location"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "「ホストの位置情報を同期」を変更できません"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "호스트 위치 동기화를 변경할 수 없음"+ }+ },+ "vi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Không thể thay đổi Đồng bộ vị trí máy chủ"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "无法更改同步主机位置"+ }+ }+ }+ },+ "Location Services Are Off in the Guest" : {+ "extractionState" : "manual",+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Location Services Are Off in the Guest"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ゲストの位置情報サービスがオフです"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "게스트의 위치 서비스가 꺼져 있음"+ }+ },+ "vi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dịch vụ định vị trên máy khách đang tắt"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "客户机的定位服务已关闭"+ }+ }+ }+ },+ "Turn on Location Services in the guest's Settings > Privacy & Security > Location Services. Until then, apps in the guest get no location; the Mac's location is sent again once they are on." : {+ "extractionState" : "manual",+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Turn on Location Services in the guest's Settings > Privacy & Security > Location Services. Until then, apps in the guest get no location; the Mac's location is sent again once they are on."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ゲストの「設定」>「プライバシーとセキュリティ」>「位置情報サービス」で位置情報サービスをオンにしてください。オンにするまで、ゲストのアプリは位置情報を取得できません。オンにすると、Mac の位置情報がもう一度送信されます。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "게스트의 설정 > 개인정보 보호 및 보안 > 위치 서비스에서 위치 서비스를 켜십시오. 켜기 전까지 게스트의 앱은 위치를 받을 수 없으며, 켜면 Mac의 위치가 다시 전송됩니다."+ }+ },+ "vi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hãy bật Dịch vụ định vị trong Cài đặt > Quyền riêng tư & Bảo mật > Dịch vụ định vị của máy khách. Trước khi bật, các ứng dụng trên máy khách không nhận được vị trí; vị trí của máy Mac sẽ được gửi lại khi dịch vụ được bật."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "请在客户机的“设置”>“隐私与安全性”>“定位服务”中打开定位服务。打开之前,客户机里的 App 拿不到位置;打开后会重新发送这台 Mac 的位置。"+ }+ }+ }+ },"Stop the Virtual Machine?" : {"extractionState" : "manual","localizations" : {diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/GuestCommunication/VPhoneGuestControl.swift b/VPhoneExecutable/VPhoneVirtualization/UI/GuestCommunication/VPhoneGuestControl.swiftindex 55ea13cb..635eea94 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/GuestCommunication/VPhoneGuestControl.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/GuestCommunication/VPhoneGuestControl.swift@@ -16,6 +16,9 @@ final class VPhoneGuestControl {case guestError(String)/// `bootstrap.install` found a completed installation in the guest.case bootstrapAlreadyInstalled(String)+ /// The guest's Location Services switch is off, so it has no location to+ /// give an app, a simulated one included.+ case locationServicesOff(String)var description: String {switch self {@@ -23,7 +26,7 @@ final class VPhoneGuestControl {VPhoneLocalization.text("The guest agent is not connected. Wait for it to connect, then try again.")case let .unsupportedCapability(value): "guest does not support capability: \(value)"case let .protocolError(value): "API protocol error: \(value)"- case let .guestError(value), let .bootstrapAlreadyInstalled(value): value+ case let .guestError(value), let .bootstrapAlreadyInstalled(value), let .locationServicesOff(value): value}}}@@ -63,6 +66,11 @@ final class VPhoneGuestControl {/// that has just started connects, from the manifest. Read at each connect,/// so a change from the menu holds from the next guest start.@ObservationIgnored var unlocksAtStartup = false+ /// Whether the Mac's location is forwarded to the guest, from the manifest.+ /// The VM window's Location menu starts from it and writes it back.+ @ObservationIgnored var syncsHostLocation = false+ /// Called on the main actor when a `location.set` or `location.clear` fails.+ @ObservationIgnored var onLocationFailure: ((Error) -> Void)?/// The `instance` of the last vphoned connected to. Kept across/// disconnects: a lost probe reconnects to the same vphoned, which is not/// a start. Guest counters such as the clipboard's change count start@@ -412,6 +420,9 @@ final class VPhoneGuestControl {if error["code"] as? String == "bootstrap_already_installed" {throw ControlError.bootstrapAlreadyInstalled(message)}+ if error["code"] as? String == "location_services_off" {+ throw ControlError.locationServicesOff(message)+ }throw ControlError.guestError(message)}guard response.status == 200, let result = envelope["result"] as? [String: Any]@@ -660,7 +671,12 @@ final class VPhoneGuestControl {orderedLocation = Task {await previous?.valueguard !Task.isCancelled, generation == locationGeneration else { return }- do { _ = try await call(method, params: params) } catch { print("[control] \(method): \(error)") }+ do {+ _ = try await call(method, params: params)+ } catch {+ print("[control] \(method): \(error)")+ onLocationFailure?(error)+ }}}diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/HostDevices/VPhoneLocationProvider.swift b/VPhoneExecutable/VPhoneVirtualization/UI/HostDevices/VPhoneLocationProvider.swiftindex 66518c86..d04e3a06 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/HostDevices/VPhoneLocationProvider.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/HostDevices/VPhoneLocationProvider.swift@@ -49,6 +49,11 @@ class VPhoneLocationProvider: NSObject {private var replayTask: Task<Void, Never>?private var replayName: String?var onAuthorizationFailure: (() -> Void)?+ /// Called once per sync, preset or replay when the guest refuses a+ /// location because its Location Services switch is off.+ var onGuestLocationServicesOff: (() -> Void)?+ private var reportedGuestServicesOff = false+ private var resendTask: Task<Void, Never>?var isReplaying: Bool {replayTask != nil@@ -57,12 +62,14 @@ class VPhoneLocationProvider: NSObject {init(control: VPhoneGuestControl) {self.control = controlsuper.init()+ control.onLocationFailure = { [weak self] error in self?.guestRefused(error) }}/// Begin sending location to the guest. Safe to call on every (re)connect.func startForwarding() {stopReplay()hostModeStarted = true+ reportedGuestServicesOff = falseif let last = lastHostLocation, abs(last.date.timeIntervalSinceNow) < 60 {forward(last)}@@ -82,6 +89,8 @@ class VPhoneLocationProvider: NSObject {if hostModeStarted {hostModeStarted = falsestopHelper()+ resendTask?.cancel()+ resendTask = nilprint("[location] stopped host location tracking")}}@@ -171,6 +180,7 @@ class VPhoneLocationProvider: NSObject {/// Send a fixed simulated location to the guest.func sendPreset(name: String, latitude: Double, longitude: Double, altitude: Double = 0) {stopReplay()+ reportedGuestServicesOff = falsesendSimulatedLocation(latitude: latitude,longitude: longitude,@@ -197,6 +207,7 @@ class VPhoneLocationProvider: NSObject {stopForwarding()stopReplay()+ reportedGuestServicesOff = falsereplayName = namelet sleepNanos = UInt64((max(intervalSeconds, 0.1) * 1_000_000_000).rounded())@@ -258,6 +269,8 @@ class VPhoneLocationProvider: NSObject {private func forward(_ location: HostLocation) {lastHostLocation = locationguard hostModeStarted else { return }+ resendTask?.cancel()+ resendTask = nilguard control.isConnected else {print("[location] forward: not connected, cached for later")return@@ -273,6 +286,25 @@ class VPhoneLocationProvider: NSObject {)}+ // MARK: - Guest Refusals++ private func guestRefused(_ error: Error) {+ guard case VPhoneGuestControl.ControlError.locationServicesOff = error else { return }+ if !reportedGuestServicesOff {+ reportedGuestServicesOff = true+ onGuestLocationServicesOff?()+ }+ // The Mac sends a fix only when it moves, so keep offering the last one+ // until someone turns Location Services on in the guest.+ guard hostModeStarted, let last = lastHostLocation, resendTask == nil else { return }+ resendTask = Task { @MainActor [weak self] in+ try? await Task.sleep(for: .seconds(10))+ guard let self, !Task.isCancelled else { return }+ resendTask = nil+ forward(lastHostLocation ?? last)+ }+ }+private func sendSimulatedLocation(latitude: Double,longitude: Double,diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuController.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuController.swiftindex 1b16743e..0f26855c 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuController.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuController.swift@@ -27,6 +27,8 @@ class VPhoneMenuController {/// Saves the unlock-at-startup setting to this machine's config.plist.var onUnlockAtStartupChange: ((Bool) throws -> Void)?var unlockAtStartupItem: NSMenuItem?+ /// Saves the Sync Host Location setting to this machine's config.plist.+ var onHostLocationSyncChange: ((Bool) throws -> Void)?var onFilesPressed: (() -> Void)?var onKeychainPressed: (() -> Void)?diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuLocation.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuLocation.swiftindex 9c9ea160..74b05cd4 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuLocation.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/Menu/VPhoneMenuLocation.swift@@ -55,7 +55,7 @@ extension VPhoneMenuController {let menu = NSMenu(title: "Location")let toggle = makeItem("Sync Host Location", action: #selector(toggleLocationSync))- toggle.state = .off+ toggle.state = control.syncsHostLocation ? .on : .offtoggle.isEnabled = falselocationMenuItem = togglemenu.addItem(toggle)@@ -99,9 +99,23 @@ extension VPhoneMenuController {refreshLocationReplayState(available: available)}+ /// Saved to this machine's config.plist, so the next start syncs, or does+ /// not, the same way. A preset or a replay pauses sync for this run only.@objc func toggleLocationSync() {guard let item = locationMenuItem else { return }- if item.state == .on {+ let enabled = item.state != .on+ do {+ try onHostLocationSyncChange?(enabled)+ control.syncsHostLocation = enabled+ } catch {+ VPhoneAlert.present(+ title: "Unable to Change Sync Host Location",+ message: error.localizedDescription,+ style: .warning,+ )+ return+ }+ if !enabled {locationProvider?.stopForwarding()control.sendLocationStop()item.state = .offdiff --git a/VPhoneExecutable/VPhoneVirtualization/UI/VPhoneVirtualMachineAppDelegate.swift b/VPhoneExecutable/VPhoneVirtualization/UI/VPhoneVirtualMachineAppDelegate.swiftindex 7b33a2de..fd5dcf5c 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/VPhoneVirtualMachineAppDelegate.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/VPhoneVirtualMachineAppDelegate.swift@@ -113,6 +113,7 @@ class VPhoneVirtualMachineAppDelegate: NSObject, NSApplicationDelegate {self.control = controlif !command.dfu {control.unlocksAtStartup = vm.unlocksAtStartup+ control.syncsHostLocation = vm.syncsHostLocationstartNetworkServices(vm: vm, control: control)let vphonedURL = URL(fileURLWithPath: command.vphonedBin)if FileManager.default.fileExists(atPath: vphonedURL.path) {@@ -192,6 +193,11 @@ class VPhoneVirtualMachineAppDelegate: NSObject, NSApplicationDelegate {try manifest.updating(unlocksAtStartup: enabled).write(to: config)try VPhoneHostFilePermissions.makeAccessible(at: config)}+ mc.onHostLocationSyncChange = { [config = command.config] enabled in+ let manifest = try VPhoneVirtualMachineManifest.load(from: config)+ try manifest.updating(syncsHostLocation: enabled).write(to: config)+ try VPhoneHostFilePermissions.makeAccessible(at: config)+ }mc.captureView = wc.captureViewmc.touchIDMonitor = wc.touchIDMonitormc.onFilesPressed = { [weak fileWC, weak control] in@@ -227,6 +233,13 @@ class VPhoneVirtualMachineAppDelegate: NSObject, NSApplicationDelegate {)alert.runModal()}+ provider.onGuestLocationServicesOff = {+ VPhoneAlert.present(+ title: "Location Services Are Off in the Guest",+ message: "Turn on Location Services in the guest's Settings > Privacy & Security > Location Services. Until then, apps in the guest get no location; the Mac's location is sent again once they are on.",+ style: .informational,+ )+ }}if let camServer = cameraServer {mc.cameraServer = camServer@@ -295,12 +308,12 @@ class VPhoneVirtualMachineAppDelegate: NSObject, NSApplicationDelegate {hostAudioLatencySync?.stop()}} else if !command.dfu {- // Headless mode: auto-start location as before (no menu exists)- control.onConnect = { [weak self, weak provider = locationProvider, weak timeZoneSync, weak hostAudioLatencySync] caps in- if caps.contains("location") {- provider?.startForwarding()- } else {+ // Headless mode: no menu, so the machine's setting alone decides.+ control.onConnect = { [weak self, weak control, weak provider = locationProvider, weak timeZoneSync, weak hostAudioLatencySync] caps in+ if !caps.contains("location") {print("[location] guest does not support location simulation")+ } else if control?.syncsHostLocation == true {+ provider?.startForwarding()}if caps.contains("timezone") {timeZoneSync?.start()diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swiftindex d3881051..bc5a9cee 100644--- a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift+++ b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift@@ -11,6 +11,8 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {let usesHardwareKeyboard: Bool/// The manifest's unlock-at-startup setting as the VM started with it.let unlocksAtStartup: Bool+ /// The manifest's Sync Host Location setting as the VM started with it.+ let syncsHostLocation: Bool/// ECID hex string resolved from machineIdentifier (e.g. "0x0012345678ABCDEF").let ecidHex: String?/// Read handle for VM serial output.@@ -248,6 +250,7 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {print("[vphone] Entropy device configured")unlocksAtStartup = manifest.unlocksScreenAtStartup+ syncsHostLocation = manifest.sharesHostLocationusesHardwareKeyboard = manifest.usesHardwareKeyboardconfig.keyboards = usesHardwareKeyboard ? [VZUSBKeyboardConfiguration()] : []print("[vphone] Hardware keyboard: \(usesHardwareKeyboard ? "enabled" : "disabled")")diff --git a/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleOperations.swift b/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleOperations.swiftindex 6d37fca5..8db00574 100644--- a/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleOperations.swift+++ b/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleOperations.swift@@ -109,6 +109,7 @@ public enum VPhoneBundleOperations {bridgeInterface: String? = nil,networkEdit: VPhoneNetworkEdit = VPhoneNetworkEdit(),unlocksAtStartup: Bool? = nil,+ syncsHostLocation: Bool? = nil,) throws -> VPhoneBundle {let bundle = try library.bundle(named: name)var edit = networkEdit@@ -122,6 +123,7 @@ public enum VPhoneBundleOperations {memorySize: memoryMB.map { $0 * 1024 * 1024 },networkConfig: network,unlocksAtStartup: unlocksAtStartup,+ syncsHostLocation: syncsHostLocation,)try updated.write(to: bundle.configURL)try VPhoneHostFilePermissions.makeAccessible(at: bundle.configURL)diff --git a/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleReport.swift b/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleReport.swiftindex 5675a89f..1f62c3f8 100644--- a/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleReport.swift+++ b/VPhoneKit/VPhoneCoreKit/Bundle/VPhoneBundleReport.swift@@ -14,6 +14,9 @@ public struct VPhoneBundleReport: Codable, Equatable, Sendable {/// present, so a client can tell a bundle that knows the setting from one/// that does not.public let unlocksAtStartup: Bool+ /// Whether vphone-vm forwards the Mac's location to the guest. Always+ /// present, like `unlocksAtStartup`.+ public let syncsHostLocation: Boolpublic init(bundle: VPhoneBundle) {name = bundle.name@@ -25,5 +28,6 @@ public struct VPhoneBundleReport: Codable, Equatable, Sendable {customFirmwareInstalled = VPhoneRestoreInfo.customFirmwareInstalled(inBundle: bundle)udid = VPhoneRestoreOperations.resolveUDID(bundle: bundle)unlocksAtStartup = bundle.manifest.unlocksScreenAtStartup+ syncsHostLocation = bundle.manifest.sharesHostLocation}}diff --git a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swiftindex d25976d7..9f835c45 100644--- a/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift+++ b/VPhoneKit/VPhoneCoreKit/VirtualMachine/VPhoneVirtualMachineManifest.swift@@ -110,6 +110,15 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {unlocksAtStartup ?? false}+ /// Whether vphone-vm forwards the Mac's location to the guest while it+ /// runs. Missing in older manifests, which keep the Mac's location to+ /// itself.+ public let syncsHostLocation: Bool?++ public var sharesHostLocation: Bool {+ syncsHostLocation ?? false+ }+// MARK: - Display/// Screen configuration@@ -351,6 +360,7 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {guestProductType: String? = nil,hardwareKeyboardEnabled: Bool? = nil,unlocksAtStartup: Bool? = nil,+ syncsHostLocation: Bool? = nil,) {schemaVersion = Self.currentSchemaVersionself.platformType = platformType@@ -367,6 +377,7 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {self.guestProductType = guestProductTypeself.hardwareKeyboardEnabled = hardwareKeyboardEnabledself.unlocksAtStartup = unlocksAtStartup+ self.syncsHostLocation = syncsHostLocation}// MARK: - Creation@@ -535,6 +546,7 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {networkConfig: NetworkConfig? = nil,hardwareKeyboardEnabled: Bool? = nil,unlocksAtStartup: Bool? = nil,+ syncsHostLocation: Bool? = nil,) -> VPhoneVirtualMachineManifest {VPhoneVirtualMachineManifest(platformType: platformType,@@ -551,6 +563,7 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {guestProductType: guestProductType,hardwareKeyboardEnabled: hardwareKeyboardEnabled ?? self.hardwareKeyboardEnabled,unlocksAtStartup: unlocksAtStartup ?? self.unlocksAtStartup,+ syncsHostLocation: syncsHostLocation ?? self.syncsHostLocation,)}@@ -573,6 +586,7 @@ public struct VPhoneVirtualMachineManifest: Codable, Sendable {guestProductType: device == .default ? nil : device.productType,hardwareKeyboardEnabled: hardwareKeyboardEnabled,unlocksAtStartup: unlocksAtStartup,+ syncsHostLocation: syncsHostLocation,)}}diff --git a/VPhoneKit/VPhoneCoreKitTests/Bundle/BundleOperationsTests.swift b/VPhoneKit/VPhoneCoreKitTests/Bundle/BundleOperationsTests.swiftindex 24e4a513..9ab90934 100644--- a/VPhoneKit/VPhoneCoreKitTests/Bundle/BundleOperationsTests.swift+++ b/VPhoneKit/VPhoneCoreKitTests/Bundle/BundleOperationsTests.swift@@ -165,6 +165,34 @@ struct BundleOperationsTests {#expect(try !lib.bundle(named: "unlock").manifest.unlocksScreenAtStartup)}+ @Test func `update config persists host location sync`() throws {+ let root = try makeRoot()+ defer { try? FileManager.default.removeItem(at: root) }+ let rom = try fakeROM(); let seprom = try fakeROM()+ defer { try? FileManager.default.removeItem(at: rom); try? FileManager.default.removeItem(at: seprom) }+ let lib = VPhoneLibrary(root: root)+ _ = try VPhoneBundleOperations.create(+ .init(name: "location", cpuCount: 8, memoryMB: 8192, diskSizeGB: 1, romSource: rom, sepromSource: seprom),+ in: lib,+ )+ #expect(VPhoneBundleReport(bundle: try lib.bundle(named: "location")).syncsHostLocation == false)++ _ = try VPhoneBundleOperations.updateConfig(+ bundleNamed: "location", in: lib, cpuCount: nil, memoryMB: nil, syncsHostLocation: true,+ )+ #expect(VPhoneBundleReport(bundle: try lib.bundle(named: "location")).syncsHostLocation)++ // Another edit leaves it alone; off turns it off.+ _ = try VPhoneBundleOperations.updateConfig(+ bundleNamed: "location", in: lib, cpuCount: nil, memoryMB: nil, unlocksAtStartup: true,+ )+ #expect(try lib.bundle(named: "location").manifest.sharesHostLocation)+ _ = try VPhoneBundleOperations.updateConfig(+ bundleNamed: "location", in: lib, cpuCount: nil, memoryMB: nil, syncsHostLocation: false,+ )+ #expect(try !lib.bundle(named: "location").manifest.sharesHostLocation)+ }+@Test func `update config persists network`() throws {let root = try makeRoot()defer { try? FileManager.default.removeItem(at: root) }@@ -438,6 +466,7 @@ struct BundleOperationsTests {machineIdentifier: Data([9, 9]),networkConfig: network,unlocksAtStartup: true,+ syncsHostLocation: true,)try manifest.write(to: created.configURL)return VPhoneBundle(url: url, manifest: manifest)@@ -465,6 +494,7 @@ struct BundleOperationsTests {#expect(manifest.cpuCount == 8)#expect(manifest.memorySize == 4096 * 1024 * 1024)#expect(manifest.unlocksAtStartup == true)+ #expect(manifest.syncsHostLocation == true)#expect(manifest.romImages?.avpBooter == src.manifest.romImages?.avpBooter)#expect(manifest.screenConfig == src.manifest.screenConfig)diff --git a/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/ManifestTests.swift b/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/ManifestTests.swiftindex 16d46ec7..8db2b926 100644--- a/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/ManifestTests.swift+++ b/VPhoneKit/VPhoneCoreKitTests/VirtualMachine/ManifestTests.swift@@ -80,6 +80,26 @@ struct ManifestTests {#expect(edited.updating(unlocksAtStartup: !enabled).unlocksScreenAtStartup == !enabled)}+ @Test func `old manifests do not share the host location`() throws {+ let data = try PropertyListEncoder().encode(sampleManifest())+ let plist = try #require(PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any])+ #expect(plist["syncsHostLocation"] == nil)+ let loaded = try PropertyListDecoder().decode(VPhoneVirtualMachineManifest.self, from: data)+ #expect(!loaded.sharesHostLocation)+ }++ @Test(arguments: [true, false])+ func `host location setting survives plist and unrelated edits`(enabled: Bool) throws {+ let original = sampleManifest().updating(syncsHostLocation: enabled)+ let data = try PropertyListEncoder().encode(original)+ let loaded = try PropertyListDecoder().decode(VPhoneVirtualMachineManifest.self, from: data)+ #expect(loaded.syncsHostLocation == enabled)+ let edited = loaded.updating(cpuCount: 4, unlocksAtStartup: !enabled)+ #expect(edited.sharesHostLocation == enabled)+ #expect(edited.updating(guestDevice: .default).sharesHostLocation == enabled)+ #expect(edited.updating(syncsHostLocation: !enabled).sharesHostLocation == !enabled)+ }+@Test func `network config round trips through plist`() throws {let dir = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfigindex b262dbe1..5bc48b7c 100644--- a/VPhoneLaunchpad/Configuration/Version.xcconfig+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig@@ -1,4 +1,4 @@-MARKETING_VERSION = 2.7.0+MARKETING_VERSION = 2.8.0// Bump whenever the helper changes. The app blesses the helper again when the// installed helper's version or bytes differ from the copy it embeds.CURRENT_PROJECT_VERSION = 15diff --git a/VPhoneLaunchpad/Tests/BundleNamesTests.swift b/VPhoneLaunchpad/Tests/BundleNamesTests.swiftindex c9d1a738..80a709da 100644--- a/VPhoneLaunchpad/Tests/BundleNamesTests.swift+++ b/VPhoneLaunchpad/Tests/BundleNamesTests.swift@@ -17,14 +17,14 @@ struct BundleNamesTests {// `-local` (legacy), `-local.<8+ lowercase hex>` or `-ci.<7+ hex>`.// Anything else is kept whole, so it never parses as a version.let expectations: [Expectation] = [- Expectation(name: "2.7.2", bundleVersion: "2.7.2", isLocalBuild: false, isCompatible: true, isValid: true),- Expectation(name: "2.7.2-local", bundleVersion: "2.7.2", isLocalBuild: true, isCompatible: true, isValid: true),- Expectation(name: "2.7.2-local.ab12cd34", bundleVersion: "2.7.2", isLocalBuild: true, isCompatible: true, isValid: true),+ Expectation(name: "2.8.2", bundleVersion: "2.8.2", isLocalBuild: false, isCompatible: true, isValid: true),+ Expectation(name: "2.8.2-local", bundleVersion: "2.8.2", isLocalBuild: true, isCompatible: true, isValid: true),+ Expectation(name: "2.8.2-local.ab12cd34", bundleVersion: "2.8.2", isLocalBuild: true, isCompatible: true, isValid: true),// The build identifier is lowercase hex; uppercase is no build.- Expectation(name: "2.7.2-local.AB12CD34", bundleVersion: "2.7.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),- Expectation(name: "2.7.2-local.ab12", bundleVersion: "2.7.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),- Expectation(name: "2.7.2-ci.abcdef1", bundleVersion: "2.7.2", isLocalBuild: false, isCompatible: true, isValid: true),- Expectation(name: "2.6.9-local.ab12cd34", bundleVersion: "2.6.9", isLocalBuild: true, isCompatible: false, isValid: true),+ Expectation(name: "2.8.2-local.AB12CD34", bundleVersion: "2.8.2-local.AB12CD34", isLocalBuild: false, isCompatible: false, isValid: true),+ Expectation(name: "2.8.2-local.ab12", bundleVersion: "2.8.2-local.ab12", isLocalBuild: false, isCompatible: false, isValid: true),+ Expectation(name: "2.8.2-ci.abcdef1", bundleVersion: "2.8.2", isLocalBuild: false, isCompatible: true, isValid: true),+ Expectation(name: "2.7.9-local.ab12cd34", bundleVersion: "2.7.9", isLocalBuild: true, isCompatible: false, isValid: true),Expectation(name: "../x", bundleVersion: "../x", isLocalBuild: false, isCompatible: false, isValid: false),Expectation(name: "", bundleVersion: "", isLocalBuild: false, isCompatible: false, isValid: false),]diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swiftindex d437b24a..883a57b5 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift@@ -274,7 +274,7 @@"network":{"mode":"nat","macAddress":"5a:94:ef:12:30:01"},"restoreInfo":{"ios":{"version":"26.4.2","build":"23E261"},"cloudOS":{"version":"26.4","build":"23E224"},"variant":"jb","device":"iPhone99,11"},"udid":"00008140-001A2B3C4D5E6F70",- "unlocksAtStartup":true},+ "unlocksAtStartup":true, "syncsHostLocation":true},{"name":"ios27-rc","cpuCount":8,"memoryMB":12288,"diskSizeBytes":128000000000,"network":{"mode":"nat","macAddress":"5a:94:ef:12:30:02"}},{"name":"frida-lab","cpuCount":6,"memoryMB":8192,"diskSizeBytes":64000000000,diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swiftindex ace0c410..9556698f 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift@@ -307,6 +307,7 @@ struct VPhoneLaunchpadControlCommands {report["udid"] = udid}report["unlocksAtStartup"] = machine.unlocksAtStartup ?? false+ report["syncsHostLocation"] = machine.syncsHostLocation ?? falseif let info = machine.restoreInfo {report["ios"] = "\(info.ios.version) (\(info.ios.build))"report["cloudOS"] = "\(info.cloudOS.version) (\(info.cloudOS.build))"diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstringsindex 1b786a55..f30fd79f 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings@@ -12856,6 +12856,33 @@"zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "在客户机内解析这台 Mac 的名称" } }}},+ "Sync this Mac's location" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Sync this Mac's location" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "この Mac の位置情報を同期" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "이 Mac의 위치 동기화" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đồng bộ vị trí của máy Mac này" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "同步这台 Mac 的位置" } }+ }+ },+ "Sync Host Location" : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "Sync Host Location" } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "ホストの位置情報を同期" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "호스트 위치 동기화" } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Đồng bộ vị trí máy chủ" } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "同步主机位置" } }+ }+ },+ "While the machine runs, the guest gets this Mac's location as a simulated location. macOS asks for permission the first time. Apps in the guest also need Location Services turned on in the guest's Settings." : {+ "localizations" : {+ "en" : { "stringUnit" : { "state" : "translated", "value" : "While the machine runs, the guest gets this Mac's location as a simulated location. macOS asks for permission the first time. Apps in the guest also need Location Services turned on in the guest's Settings." } },+ "ja" : { "stringUnit" : { "state" : "translated", "value" : "マシンの実行中、ゲストはこの Mac の位置情報をシミュレートされた位置情報として受け取ります。初回は macOS が許可を求めます。ゲストのアプリが位置情報を使うには、ゲストの「設定」で位置情報サービスをオンにする必要もあります。" } },+ "ko" : { "stringUnit" : { "state" : "translated", "value" : "머신이 실행되는 동안 게스트는 이 Mac의 위치를 시뮬레이션된 위치로 받습니다. 처음에는 macOS가 권한을 요청합니다. 게스트의 앱이 위치를 사용하려면 게스트의 설정에서 위치 서비스도 켜야 합니다." } },+ "vi" : { "stringUnit" : { "state" : "translated", "value" : "Trong khi máy chạy, máy khách nhận vị trí của máy Mac này dưới dạng vị trí mô phỏng. Lần đầu, macOS sẽ hỏi quyền. Các ứng dụng trên máy khách còn cần bật Dịch vụ định vị trong Cài đặt của máy khách." } },+ "zh-Hans" : { "stringUnit" : { "state" : "translated", "value" : "机器运行期间,客户机会以模拟位置的形式收到这台 Mac 的位置。第一次会由 macOS 请求权限。客户机里的 App 还需要在客户机的“设置”中打开定位服务。" } }+ }+ },"Startup" : {"localizations" : {"en" : { "stringUnit" : { "state" : "translated", "value" : "Startup" } },diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swiftindex 387bc66d..265ce8c4 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift@@ -96,11 +96,15 @@ nonisolated struct VPhoneLaunchpadMachine: Decodable, Hashable, Identifiable, Se/// Whether vphone-vm unlocks the guest each time it starts. Nil from a/// bundle older than the setting.let unlocksAtStartup: Bool?+ /// Whether vphone-vm forwards the Mac's location to the guest. Nil from a+ /// bundle older than the setting.+ let syncsHostLocation: Bool?/// The library `vm list` was run on. Not part of the JSON.var libraryRoot = ""private enum CodingKeys: String, CodingKey {- case name, cpuCount, memoryMB, diskSizeBytes, network, restoreInfo, customFirmwareInstalled, udid, unlocksAtStartup+ case name, cpuCount, memoryMB, diskSizeBytes, network, restoreInfo, customFirmwareInstalled, udid, unlocksAtStartup,+ syncsHostLocation}/// The inspector's firmware line. A restore whose CFW install neverdiff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swiftindex d89c5427..c45b10ea 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift@@ -149,6 +149,9 @@ struct VPhoneLaunchpadMachineInspector: View {if machine.unlocksAtStartup == true {LabeledContent("Unlock at Startup", value: String(localized: "On"))}+ if machine.syncsHostLocation == true {+ LabeledContent("Sync Host Location", value: String(localized: "On"))+ }}Section("Identity") {diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swiftindex 757c8e01..1a52fe3f 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift@@ -636,6 +636,7 @@ final class VPhoneLaunchpadMachineLibrary {bridgeInterface: String?,networkArguments: [String] = [],unlocksAtStartup: Bool? = nil,+ syncsHostLocation: Bool? = nil,) async {var arguments = ["vm", "config", machine.name] + machine.libraryArgumentsif let cpu {@@ -654,6 +655,9 @@ final class VPhoneLaunchpadMachineLibrary {if let unlocksAtStartup {arguments += ["--unlock-at-startup", unlocksAtStartup ? "on" : "off"]}+ if let syncsHostLocation {+ arguments += ["--sync-host-location", syncsHostLocation ? "on" : "off"]+ }await perform(String(localized: "Saving settings…"), on: machine, arguments)}diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swiftindex 1ccfcd30..a64afb1a 100644--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift@@ -3,14 +3,14 @@ import SwiftUI// MARK: - Settings-/// Hardware, network and startup for one machine, or for several at once. The+/// Hardware, network, startup and location for one machine, or for several at once. The/// fields start from the first machine; only the ones edited are written, to/// every machine, so values the machines do not share are left alone. A fixed/// address, a MAC and forwarded ports belong to one machine, so they are only/// offered when one is selected, on pages of their own.struct VPhoneLaunchpadMachineSettingsView: View {private enum Field {- case cpu, memory, network, address, mac, forwards, mdns, macName, unlock+ case cpu, memory, network, address, mac, forwards, mdns, macName, unlock, location}enum Page: Hashable {@@ -34,6 +34,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {@State private var advertisesName: Bool@State private var resolvesMacName: Bool@State private var unlocksAtStartup: Bool+ @State private var syncsHostLocation: Bool@State private var newTransport = "tcp"@State private var newHostPort = ""@State private var newGuestPort = ""@@ -57,6 +58,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {_advertisesName = State(initialValue: first?.network.localHostName != nil)_resolvesMacName = State(initialValue: first?.network.resolvesMacName != false)_unlocksAtStartup = State(initialValue: first?.unlocksAtStartup == true)+ _syncsHostLocation = State(initialValue: first?.syncsHostLocation == true)}private var title: Text {@@ -134,6 +136,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {}if !single || page == .general {startupSection+ locationSection}}.formStyle(.grouped)@@ -160,6 +163,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {.onChange(of: advertisesName) { edited.insert(.mdns) }.onChange(of: resolvesMacName) { edited.insert(.macName) }.onChange(of: unlocksAtStartup) { edited.insert(.unlock) }+ .onChange(of: syncsHostLocation) { edited.insert(.location) }#if DEBUG.onAppear {if VPhoneLaunchpadPreview.isActive {@@ -189,6 +193,17 @@ struct VPhoneLaunchpadMachineSettingsView: View {}}+ private var locationSection: some View {+ Section {+ Toggle("Sync this Mac's location", isOn: $syncsHostLocation)+ } header: {+ Text("Location")+ } footer: {+ Text("While the machine runs, the guest gets this Mac's location as a simulated location. macOS asks for permission the first time. Apps in the guest also need Location Services turned on in the guest's Settings.")+ .foregroundStyle(.secondary)+ }+ }+private var networkSection: some View {Section {Picker("Mode", selection: $network) {@@ -340,6 +355,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {let network = edited.contains(.network) ? network : nillet bridgeInterface = network == "bridged" ? bridgeInterface : nillet unlocksAtStartup = edited.contains(.unlock) ? unlocksAtStartup : nil+ let syncsHostLocation = edited.contains(.location) ? syncsHostLocation : nilvar networkArguments: [String] = []if single {if edited.contains(.address) {@@ -383,6 +399,7 @@ struct VPhoneLaunchpadMachineSettingsView: View {bridgeInterface: bridgeInterface,networkArguments: networkArguments,unlocksAtStartup: unlocksAtStartup,+ syncsHostLocation: syncsHostLocation,)}}diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swiftindex 2a3a2f9d..21d9b19f 100644--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadBundleStore.swift@@ -79,8 +79,9 @@ nonisolated enum VPhoneLaunchpadNames {/// lists and the helper runs to release orphaned DHCP leases. 2.6.0 added/// `vm config --unlock-at-startup`, which a machine's Settings pass. 2.7.0/// added `vm clone --new-identity`, which Clone passes, and- /// `vm snapshot`, which the Snapshots sheet runs.- private static let minimumBundleComponents = (2, 7, 0)+ /// `vm snapshot`, which the Snapshots sheet runs. 2.8.0 added `vm config+ /// --sync-host-location`, which a machine's Settings pass.+ private static let minimumBundleComponents = (2, 8, 0)static let minimumBundleVersion ="\(minimumBundleComponents.0).\(minimumBundleComponents.1).\(minimumBundleComponents.2)"