Skip to content

Instantly share code, notes, and snippets.

@guttentag
Last active September 4, 2019 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guttentag/7a6f38cd804ee7d8996b120e4c83f9cd to your computer and use it in GitHub Desktop.
Save guttentag/7a6f38cd804ee7d8996b120e4c83f9cd to your computer and use it in GitHub Desktop.
XCODE - Run app on all connected devices
function run(input, parameters) {
var xcode = Application("Xcode");
var ws = xcode.activeWorkspaceDocument();
var genericDest = null;
var devices = [];
ws.runDestinations().forEach(function(runDest)
{
if (runDest.platform() != "iphoneos")
return;
if (runDest.device().generic())
{
genericDest = runDest;
}
else
{
devices.push(runDest);
}
});
devices.forEach(function(device)
{
ws.activeRunDestination = device;
var buildResult = ws.run();
while (true)
{
if (buildResult.completed())
break;
if (buildResult.buildLog() && buildResult.buildLog().endsWith("Build succeeded\n"))
break;
delay(1);
}
delay(1);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment