@@ -6,6 +6,7 @@ import stream = require("stream");
6
6
import path = require( "path" ) ;
7
7
import http = require( "http" ) ;
8
8
import Future = require( "fibers/future" ) ;
9
+ import semver = require( "semver" ) ;
9
10
10
11
module notification {
11
12
function formatNotification ( bundleId : string , notification : string ) {
@@ -71,7 +72,8 @@ class IOSDebugService implements IDebugService {
71
72
private $errors : IErrors ,
72
73
private $injector : IInjector ,
73
74
private $npmInstallationManager : INpmInstallationManager ,
74
- private $options : IOptions ) { }
75
+ private $options : IOptions ,
76
+ private $projectDataService : IProjectDataService ) { }
75
77
76
78
get platform ( ) : string {
77
79
return "ios" ;
@@ -142,6 +144,7 @@ class IOSDebugService implements IDebugService {
142
144
} ) ;
143
145
awaitNotification ( npc , notification . readyForAttach ( projectId ) , 5000 ) . wait ( ) ;
144
146
} catch ( e ) {
147
+ this . $logger . trace ( `Timeout error: ${ e } ` ) ;
145
148
this . $errors . failWithoutHelp ( "Timeout waiting for NativeScript debugger." ) ;
146
149
}
147
150
@@ -205,9 +208,19 @@ class IOSDebugService implements IDebugService {
205
208
private openDebuggingClient ( ) : IFuture < void > {
206
209
return ( ( ) => {
207
210
let inspectorPath = this . getInspectorPath ( ) . wait ( ) ;
208
- let inspectorApplicationPath = path . join ( inspectorPath , "NativeScript Inspector.app" ) ;
209
211
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
+
211
224
this . $childProcess . exec ( cmd ) . wait ( ) ;
212
225
} ) . future < void > ( ) ( ) ;
213
226
}
0 commit comments