@@ -6,6 +6,7 @@ import stream = require("stream");
66import path = require( "path" ) ;
77import http = require( "http" ) ;
88import Future = require( "fibers/future" ) ;
9+ import semver = require( "semver" ) ;
910
1011module notification {
1112 function formatNotification ( bundleId : string , notification : string ) {
@@ -71,7 +72,8 @@ class IOSDebugService implements IDebugService {
7172 private $errors : IErrors ,
7273 private $injector : IInjector ,
7374 private $npmInstallationManager : INpmInstallationManager ,
74- private $options : IOptions ) { }
75+ private $options : IOptions ,
76+ private $projectDataService : IProjectDataService ) { }
7577
7678 get platform ( ) : string {
7779 return "ios" ;
@@ -142,6 +144,7 @@ class IOSDebugService implements IDebugService {
142144 } ) ;
143145 awaitNotification ( npc , notification . readyForAttach ( projectId ) , 5000 ) . wait ( ) ;
144146 } catch ( e ) {
147+ this . $logger . trace ( `Timeout error: ${ e } ` ) ;
145148 this . $errors . failWithoutHelp ( "Timeout waiting for NativeScript debugger." ) ;
146149 }
147150
@@ -205,9 +208,19 @@ class IOSDebugService implements IDebugService {
205208 private openDebuggingClient ( ) : IFuture < void > {
206209 return ( ( ) => {
207210 let inspectorPath = this . getInspectorPath ( ) . wait ( ) ;
208- let inspectorApplicationPath = path . join ( inspectorPath , "NativeScript Inspector.app" ) ;
209211 let inspectorSourceLocation = path . join ( inspectorPath , "Safari/Main.html" ) ;
210- let cmd = `open -a '${ inspectorApplicationPath } ' --args '${ inspectorSourceLocation } ' '${ this . $projectData . projectName } '` ;
212+ let cmd : string = null ;
213+
214+ this . $projectDataService . initialize ( this . $projectData . projectDir ) ;
215+ let platformData = this . $platformsData . getPlatformData ( this . platform ) ;
216+ let frameworkVersion = this . $projectDataService . getValue ( platformData . frameworkPackageName ) . wait ( ) . version ;
217+ if ( semver . lt ( frameworkVersion , "1.2.0" ) ) {
218+ cmd = `open -a Safari "${ inspectorSourceLocation } "` ;
219+ } else {
220+ let inspectorApplicationPath = path . join ( inspectorPath , "NativeScript Inspector.app" ) ;
221+ cmd = `open -a '${ inspectorApplicationPath } ' --args '${ inspectorSourceLocation } ' '${ this . $projectData . projectName } '` ;
222+ }
223+
211224 this . $childProcess . exec ( cmd ) . wait ( ) ;
212225 } ) . future < void > ( ) ( ) ;
213226 }
0 commit comments