Skip to content

Fix livesync + debug on iOS Simulator #3334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov commented Jan 23, 2018

When tns debug ios is used, each change of application's code will trigger restart of app and Chrome DevTools will be disconnected. CLI prints the "new" URL and in case you copy it and paste it immediately in the browser, you'll receive empty DevTools. The problem is that the URL is printed before application is launched successfully on simulator.
In order to resolve this issue, try connection on port 18181 - the connection will be successfull only when the application is running. Wait 10 seconds to connect and throw error in case we are unable to connect for this time.

Also fix incorrect behavior of connectionError event - the thrown error should contain the deviceIdentifier, but it was missing.

NOTE: Merge after telerik/mobile-cli-lib#1041

@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/fix-ios-sim-debug-livesync branch from 06db1e4 to a60bdb1 Compare January 24, 2018 08:53
@@ -212,7 +225,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
this.$logger.info("'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.");
}

this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device));
this._socketProxy = await this.$socketProxyFactory.createWebSocketProxy(this.getSocketFactory(device), device.deviceInfo.identifier);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device is not a mandatory argument, so you may receive Cannot read property 'deviceInfo' of undefined.

When `tns debug ios` is used, each change of application's code will trigger restart of app and Chrome DevTools will be disconnected. CLI prints the "new" URL and in case you copy it and paste it immediately in the browser, you'll receive empty DevTools. The problem is that the URL is printed before application is launched successfully on simulator.
In order to resolve this issue, try connection on port 18181 - the connection will be successfull only when the application is running. Wait 10 seconds to connect and throw error in case we are unable to connect for this time.

Also fix incorrect behavior of connectionError event - the thrown error should contain the deviceIdentifier, but it was missing.
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/fix-ios-sim-debug-livesync branch from a60bdb1 to 73bb06b Compare January 24, 2018 10:35
@rosen-vladimirov
Copy link
Contributor Author

run ci

@rosen-vladimirov rosen-vladimirov merged commit 1658629 into release Jan 24, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-ios-sim-debug-livesync branch January 24, 2018 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants