Skip to content

tns run command refreshes both platforms #3359

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

Closed
erkanarslan opened this issue Feb 8, 2018 · 7 comments
Closed

tns run command refreshes both platforms #3359

erkanarslan opened this issue Feb 8, 2018 · 7 comments
Labels

Comments

@erkanarslan
Copy link

Did you verify this is a real problem by searching the [NativeScript Forum]

Yes

Tell us about the problem

I usually work on both iOS and Android devices. Both devices work at the same time. If I run tns run android command without making any changes to the code, iOS app is also refreshed. Opposite of this is also true.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.4.0
  • Runtime(s): 3.4.1 for both platforms

Please tell us how to recreate the issue in as much detail as possible.

Start an iOS or an Android device/simulator. While it is working, open another terminal and run tns run for other platform. Other one is also refreshed without any code change.

@tsonevn
Copy link
Contributor

tsonevn commented Feb 9, 2018

Hi @erkanarslan,
If I understand you correctly you start tns run command for both platforms at the same time and the application will be refreshed on both, when you make some changes in the application.

This is expected behaviour. While you starting the second tns run command, the previous one will keep running and the changes will sync on the Android device as well as the iOS one.

Regarding that, it would help if you provide some more info about the case and why you think that this is a bug?

@erkanarslan
Copy link
Author

@tsonevn This is not what I meant.

I run tns run ios and start my app on an iPhone. While it is running, I run tns run android command. I didn't make any changes to the code between running these two commands. But when android application starts, iphone app is also refreshed. There is no code change.

Then, if I stop tns run ... command by hitting Ctrl + C and run it again for a device, other device refreshed again. This shouldn't happen.

@Natalia-Hristova
Copy link

Hi @erkanarslan ,

This behavior is known and expected. The reason is that when you start tns run ios this starts a watcher in the app/ folder. The moment you start tns run android in another terminal you start another watcher in the same folder. When the second watcher is started it modifies the file's access time or modify time (I'm not sure which one) and it causes the first watcher to trigger.

@erkanarslan
Copy link
Author

Thanks for your response. This shouldn't be an expected behavior. Why does a watcher need to change file dates? Only we should change them and watchers should just watch and refresh.

@Plamen5kov
Copy link
Contributor

Hi @erkanarslan,
If you want to develop for ios and android at the same time I'd suggest using the tns run command. This command should start the application on both the ios simulator and an android emulator.
Keep in mind that the command won't start the emulator/simulator for you, they need to be already running.
This is an alternative and the recommended way to develop for both platforms at the same time instead of running two separate commands on two terminals.

@erkanarslan
Copy link
Author

@Plamen5kov I didn't know that and didn't see it in the documentation. I will try it. Thanks

@Fatme
Copy link
Contributor

Fatme commented Apr 5, 2018

Hi @erkanarslan,

The documentation is already fixed so I'm closing this issue. Fell free to reopen it and/or open an another issue in case you have some problems.

@Fatme Fatme closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants