-
-
Save cb1kenobi/19dc4c547864a96bfa9027aae5631e67 to your computer and use it in GitHub Desktop.
'use strict'; | |
const execSync = require('child_process').execSync; | |
const json = JSON.parse(execSync('xcrun simctl list --json')); | |
for (const runtime of Object.keys(json.devices)) { | |
for (const device of json.devices[runtime]) { | |
console.log(`Removing ${device.name} (${device.udid})`); | |
execSync(`xcrun simctl delete ${device.udid}`); | |
} | |
} | |
for (const deviceType of json.devicetypes) { | |
for (const runtime of json.runtimes) { | |
if (runtime.isAvailable || runtime.availability === '(available)') { | |
console.log(`\nCreating ${deviceType.name} with ${runtime.name}`); | |
try { | |
execSync(`xcrun simctl create '${deviceType.name} ${runtime.name}' ${deviceType.identifier} ${runtime.identifier}`); | |
console.log('SUCCESS!'); | |
} catch (e) {} | |
} | |
} | |
} | |
console.log(); | |
console.log(execSync('xcrun simctl list').toString()); |
@lokeshchdhry Fixed! Thank you!
this doesn't work for me. Anything need to do extra ?
This gist is no longer supported. I've migrated it to ioslib
and exposed it via a CLI:
npm i -g ioslib
ioslib reset-sims
Note that the code is pretty much the same as what's in ioslib, but you might have better luck. If not, create an issue against ioslib and we'll investigate.
@aviboy2006 You probably need to run npm install as sudo.
Its works as per this tidev/ioslib#114 but actual issue not able to solve using this.
I ran command then i tried tn iphone-8
command
but still same error.
[TRACE] [ioslib] Selected iOS Simulator: iPhone 8 iOS 12.0
[TRACE] [ioslib] UDID = 40F2378E-24BC-459C-9E1E-5BA7488BB853
[TRACE] [ioslib] iOS = 12.0
[TRACE] [ioslib] Autoselected Xcode: 10.0
[TRACE] [ioslib] Checking if the simulator /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator is already running
[TRACE] [ioslib] Simulator is not running
[TRACE] [ioslib] Tailing iPhone 8 iOS 12.0 Simulator system log: /Users/avinash.dalvi/Library/Logs/CoreSimulator/40F2378E-24BC-459C-9E1E-5BA7488BB853/system.log
[ERROR] Simulator is not available
As the error indicates, your simulator is not available. You should try to manually launch it, then reset it. You can also do this via simctl.
Secondly, tn
is a community project and is not supported by me or the Titanium team, please use the Appc CLI (or Titanium CLI).
Lastly, this gist is not the correct place to get Titanium support. I recommend hopping on https://ti-slack.slack.com/ or request an account at https://jira.appcelerator.org/ and file a ticket.
Line 15 now should be
runtime.isAvailable === true
I guess the key & value have changed in xcode 11.
This helped me a lot. Thanks Chris 👍