diff --git a/src/dispatcher/iOSDevice.tsx b/src/dispatcher/iOSDevice.tsx index 0b7565303..b0ea4355c 100644 --- a/src/dispatcher/iOSDevice.tsx +++ b/src/dispatcher/iOSDevice.tsx @@ -70,7 +70,7 @@ async function queryDevices(store: Store, logger: Logger): Promise { if (!(await checkIfDevicesCanBeQueryied(store))) { return; } - await checkXcodeVersionMismatch(); + await checkXcodeVersionMismatch(store); const {connections} = store.getState(); const currentDeviceIDs: Set = new Set( connections.devices @@ -169,7 +169,7 @@ function queryDevicesForever(store: Store, logger: Logger) { } let xcodeVersionMismatchFound = false; -async function checkXcodeVersionMismatch() { +async function checkXcodeVersionMismatch(store: Store) { if (xcodeVersionMismatchFound) { return; } @@ -184,9 +184,17 @@ async function checkXcodeVersionMismatch() { ); const runningVersion = match && match.length > 0 ? match[0].trim() : null; if (runningVersion && runningVersion !== xcodeCLIVersion) { - console.error( - `Xcode version mismatch: Simulator is running from "${runningVersion}" while Xcode CLI is "${xcodeCLIVersion}". Running "xcode-select --switch ${runningVersion}" can fix this.`, - ); + const errorMessage = `Xcode version mismatch: Simulator is running from "${runningVersion}" while Xcode CLI is "${xcodeCLIVersion}". Running "xcode-select --switch ${runningVersion}" can fix this.`; + store.dispatch({ + type: 'SERVER_ERROR', + payload: { + message: errorMessage, + details: + "You might want to run 'sudo xcode-select -s /Applications/Xcode.app/Contents/Developer'", + }, + }); + // Fire a console.error as well, so that it gets reported to the backend. + console.error(errorMessage); xcodeVersionMismatchFound = true; break; }