Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import stream = require("stream");
import path = require("path");
import http = require("http");
import Future = require("fibers/future");
import semver = require("semver");

module notification {
function formatNotification(bundleId: string, notification: string) {
Expand Down Expand Up @@ -71,7 +72,8 @@ class IOSDebugService implements IDebugService {
private $errors: IErrors,
private $injector: IInjector,
private $npmInstallationManager: INpmInstallationManager,
private $options: IOptions) { }
private $options: IOptions,
private $projectDataService: IProjectDataService) { }

get platform(): string {
return "ios";
Expand Down Expand Up @@ -142,6 +144,7 @@ class IOSDebugService implements IDebugService {
});
awaitNotification(npc, notification.readyForAttach(projectId), 5000).wait();
} catch(e) {
this.$logger.trace(`Timeout error: ${e}`);
this.$errors.failWithoutHelp("Timeout waiting for NativeScript debugger.");
}

Expand Down Expand Up @@ -205,9 +208,19 @@ class IOSDebugService implements IDebugService {
private openDebuggingClient(): IFuture<void> {
return (() => {
let inspectorPath = this.getInspectorPath().wait();
let inspectorApplicationPath = path.join(inspectorPath, "NativeScript Inspector.app");
let inspectorSourceLocation = path.join(inspectorPath, "Safari/Main.html");
let cmd = `open -a '${inspectorApplicationPath}' --args '${inspectorSourceLocation}' '${this.$projectData.projectName}'`;
let cmd: string = null;

this.$projectDataService.initialize(this.$projectData.projectDir);
let platformData = this.$platformsData.getPlatformData(this.platform);
let frameworkVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait().version;
if(semver.lt(frameworkVersion, "1.2.0")) {
cmd = `open -a Safari "${inspectorSourceLocation}"`;
} else {
let inspectorApplicationPath = path.join(inspectorPath, "NativeScript Inspector.app");
cmd = `open -a '${inspectorApplicationPath}' --args '${inspectorSourceLocation}' '${this.$projectData.projectName}'`;
}

this.$childProcess.exec(cmd).wait();
}).future<void>()();
}
Expand Down