Files unexpectedly reverted to previous version


Hi, not sure how this ever could be the case, but my files in my Nativescript app folder reverted to a version from like 2 weeks ago…

This is an Nativescript iOS project made on an a Mac Mini.

Today I have updated nativescript and some modules. That change broke Xcode build process so had to remove and reinstall iOS platform, then the build succeeded. However, the app folder structure has changed to an earlier version.

How on earth could that be possible? Is there something caching versions? I am not running any source control here so I would expect the files to always be the latest version.


Could this be XCode or even OSX messing with the files? Is XCode somehow managing file versions on its own? Could the removal of the build folders cause it to “lose track” of the file versions?


OK I found how this happens but not why.

I build my app with XCode and it works absolutely fine. However when I decide to build through terminal, the files get reverted to the original version. Luckily this time around I had GIT to the rescue so no biggie.

Why does this happen? What kind of logic does it follow? Does it matter to TNS where the files are being authored? It feels like somehow TNS ignores all changes that occur within XCode. I simply do not understand this behaviour.


I will assume that XCode works with the files after they’ve been prepared (platforms/ios), meaning any changes made to them, will not persist in your source files (which the CLI prepares, and overwrites in platforms/ios if necessary).


Is that OS-specific behaviour? I don’t quite understand what you mean by “CLI prepares”, to me they are just files on a hard drive. It should not matter where I make changes to them, the build should always respect the current state of the source files.


The build process of a NativeScript application can roughly be split in 2 parts - prepare, build. Run includes an addition step - deploy.

NativeScript application files - myApp/app directory - persistent
Native application files - 'myApp/platforms/ios | android` directory - can change at any time, can be remade at any point

The Prepare steps ‘prepares’ all your nativescript project files, makes whatever transformations are necessary (including transpilation), and places them into the native project. The changes you make inside platforms/ios will not reflect in your NativeScript application, so while they may be valid for the current build (should you build in XCode), that is likely to not be the case when you build with the CLI (changes in platforms/ios will be replaced by the aforementioned process)

Build is the process of building the native project using the appropriate build system/IDE. (XCode for iOS, Gradle for Android)

And Deploy is just pushing the binary produced from the build step to the device, and firing it up.


OK thanks for that explanation.

In that case I would like to report that the files that should be persistent ARE NOT PERSISTENT.

I am absolutely positively 100% only working within myApp/app/views. However the files in that folder DO CHANGE if I initiate the build from CLI using “tns build ios”. They revert to the original version that I started with several weeks ago.

If I build from XCode, the latest version is respected and works correctly.

I’ve read somewhere that on OSX you can get several versions of the same file using some TextEdit technique where you select on a timeline the version you want. Is NS maybe using the first version instead of the last one? Long shot but worth mentioning.