Skip to content

Commit 6e4c61f

Browse files
committed
make default debug-ios behavior to use chrome-devtools instead of safari web inspector
1 parent 38016f5 commit 6e4c61f

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

docs/man_pages/project/testing/debug-ios.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ While debugging, prints the output from the application in the console and watch
2626
* `--timeout` - Sets the number of seconds that NativeScript CLI will wait for the simulator/device to boot. If not set, the default timeout is 90 seconds.
2727
* `--no-watch` - If set, changes in your code will not be reflected during the execution of this command.
2828
* `--clean` - If set, forces rebuilding the native application.
29-
* `--chrome` - Allows debugging in Chrome Developer Tools. If set Safari Web Inspector is not started and debugging is attached to Chrome Developer Tools.
29+
* `--chrome` - Deprecated - default behavior uses '--chrome' implicitly. Allows debugging in Chrome Developer Tools. If set, Safari Web Inspector is not started and debugging is attached to Chrome Developer Tools.
30+
* `--inspector` - If set, the developer tools in the Safari Web Inspector are used for debugging the application.
3031

3132
### Attributes
3233
* `<Device ID>` is the device identifier of the target device as listed by `$ tns device ios`

lib/declarations.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ interface IOptions extends ICommonOptions, IBundle, IPlatformTemplate, IEmulator
393393
syncAllFiles: boolean;
394394
liveEdit: boolean;
395395
chrome: boolean;
396+
inspector: boolean; // the counterpart to --chrome
396397
}
397398

398399
interface IEnvOptions {

lib/definitions/debug.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ interface IDebugOptions {
8282
* Default value is 02e6bde1bbe34e43b309d4ef774b1168d25fd024 which corresponds to 55.0.2883 Chrome version
8383
*/
8484
devToolsCommit?: string;
85+
86+
/**
87+
* Defines if the iOS App Inspector should be used instead of providing URL to debug the application with Chrome DevTools
88+
*/
89+
inspector?: boolean;
8590
}
8691

8792
/**

lib/services/ios-debug-service.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,17 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
201201
}
202202

203203
private async wireDebuggerClient(debugData: IDebugData, debugOptions: IDebugOptions, device?: Mobile.IiOSDevice): Promise<string> {
204-
if (debugOptions.chrome || !this.$hostInfo.isDarwin) {
205-
this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));
206-
207-
return this.getChromeDebugUrl(debugOptions, this._socketProxy.options.port);
208-
} else {
204+
if (debugOptions.inspector && this.$hostInfo.isDarwin) {
209205
this._socketProxy = await this.$socketProxyFactory.createTCPSocketProxy(this.getSocketFactory(device));
210206
await this.openAppInspector(this._socketProxy.address(), debugData, debugOptions);
211207
return null;
208+
} else {
209+
if (debugOptions.chrome) {
210+
this.$logger.info("'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.");
211+
}
212+
213+
this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));
214+
return this.getChromeDebugUrl(debugOptions, this._socketProxy.options.port);
212215
}
213216
}
214217

0 commit comments

Comments
 (0)