iosiconsnativescriptpreviewtns

tns preview not recognizing ios images for tabview tabItems added via App_Resources


Inbox and calendar images in App_Resources directory

inbox and calendar images in App_Resources directory

They appear here and in the platforms > ios > AppName > Resources directory after running tns build.

Inbox and calendar images in platforms Resources directory

inbox and calendar images in platforms Resources directory

However when running app via tns preview, they do not sync to the phone/device

Missing inbox and calendar icons in tns preview

missing inbox and calendar icons in tns preview


Solution

  • Short answer:

    Additions or deletions in the App_Resources directory are not sync to the preview app. When such changes are desired you will have to setup NativeScript and its dependencies on your machine (Android SDKs, Simulators, XCode etc.)

    Long answer:

    The tns preview command has some limitations to what changes can be synced and applied from your project. The general rule that you should have in mind is that any changes related to newly added files that cannot be converted to JS like image files, icons etc. will not be synced to the preview app. Such is the case with anything new you add to the App_Resources directory.

    When running tns preview you should be prompted with warning for any files that will not be synced in the terminal. Also you can run tns preview help to see notes regarding this command and how to use it.