If you are needing to use a plugin that hasn't been upgraded to support 3.0 you basically have three choices, and guess what I can help with each of them...
Wait for it to be updated; you can check my site http://plugins.nativescript.rocks; then select the "3.0" plugins list, now you can easily see when a plugin has 3.0 compatibility.
Update it your self; or since I'm a contractor; you pay me; I will upgrade the plugin for you.
Downgrade to NativeScript 2.5; I suspect most of you are the most interested in this since you are here...
The good news is that several of the 3.0 parts are backwards compatible. You can be running the 3.0 NativeScript command line and build 2.5 apps. You can also be using the 3.0 release runtimes with the core 2.5. modules. So here is the way to downgrade a 3.0 app into a 2.5 app.
To downgrade PAN (Plain Awesome NativeScript) apps:
One note that seems to confuse some people; you can continue to use the NativeScript 3.0 CLI with NativeScript 2.5 applications. You can also use the 3.0 Runtimes (highly recommended actually) with your 2.5 Core modules applications.
Any of my 2.5 applications are now (This setup is fully 2.5 plugin compatible):
- 3.0 CLI
- 3.0 Runtimes
- 2.5 TNS Core Modules (if NAN, then you need the old Angular stuff as listed above)
And my 3.0 applications are (This is the standard 3.0 setup)
- 3.0 CLI
- 3.0 Runtimes
- 3.0 TNS Core Modules (if NAN, then you need the new 3.0 compatible Angular Stuff)
At this moment the largest difference is the backend data storage system has been completely changed; and now has a lot of new data available to it. This system should allow us to do some more pretty cool things in the future...
By using this new data; I also have a bit more accurate plugin list, In addition the new system has the ability to track both NativeScript 2.x plugins and separately 3.x. So on the page you can now see a select list that allows you to change "All" (All plugins), "2.x" plugins that should be only 2.x compatible; and then finally only 3.x compatible. In addition I took the time to actually drop a physical search bar in the title area; as my virtual search bar seemed to confuse a lot of people.
Play around with it, let me know if you run into any issues.
Then you can type tns info and verify that everything says 3.0.x
Plugins fails; this is a known issue do to the complete revamp of the lower levels of the core modules design. Some plugins need a lot of changes to work in 3.0; so you will have to wait for the third party authors to get caught up. My plugins site http://plugins.nativescript.rocks should be listing both version v2 & v3 plugins separately so that you can easily find 3.0 or 2.0 plugins shortly.
TypeScript incompatibilities; you should be using 2.2 or later with v3.0 of TNS
For those who are not aware, v3.0 of NativeScript is the next major version that will be released. It has been being worked on for several months now as it has parts of it have been completely rewritten to enhance speed of the framework in a number of areas. Some parts of it have undergone radical changes in design, and as such will require changes to plugins to make them compatible.
Unfortunately these changes are a breaking change and will mess up the plugins for a while...
Some pre-release information has trickled out and as such the plugin developers needs to be made aware of these changes, so we can start getting a jump on these changes...
The biggest issue is any plugins that deals with any properties, or stylers has been completely changed. These plugins will HAVE to be changed to support 3.0. This means your plugin will no longer be NS <= 2.5 compatible, these are BREAKING changes.
Plugin Sites and the Package.json
As an aside if your plugin doesn't have any breaking changes and can continue to work fine in all versions of NS; then I am asking you to add a new flag to your package.json file to flag that this plugin is 3.0 compatible but doesn't require 3.0.
Your package JSON NativeScript section should look like this:
The additional "plugin" structure is being introduced to try and capture the data that has been missing from the plugin infrastructure. At this moment each item is totally optional. However, this will allow the plugin sites to categories and filter the plugins based on criteria's that are important to subsets of the users using the plugin sites. Please see: http://fluentreports.com/blog/?p=489 for more details on the new "plugin" structure proposal.
Back to the breaking Changes
The first resource is that some of the NativeScript team produced a video last week https://youtu.be/bwO3cYPb4zQ which will give a decent overview of the changes.
The developers working on the 3.0 project gave a run down of the changes and how they benefit us and/or what changes we need to be concerned about.
They used this document in the above video; but since they only covered an overview and this documents has all the nitty-gritty details.
For this to be a smooth transition I really strongly encourage you on the "core3" attribute be used if you are not just bumping your platforms to 3.0.0. I will be automatically filtering out plugins that I believe are only 2.0 for 2.0 mode and 3.0 for 3.0 mode. So having things tagged correctly will help the end users have a much more painless transition.
Some of you might not be aware but I wrote the plugins.nativescript.rocks. I also helped write the plugins.nativescript.org site (if something doesn't work on plugins.nativescript.org; please blame my cohorts in crime, Nathan Walker and George Edwards. I had NOTHING to do with any bugs! 😛 )
Well, with the new upcoming changes in 3.0 and some data that we have been unable to determine I have decided to request that the plugin authors add a little bit more metadata to the package.json file that comes with the plugin.
This tells nativescript which version of NativeScript runttimes are supported. This allows the TNS command line to throw and error/warning if you are not using the proper versions. This is useful information as this tells us what platforms are supported. However, this fails when people (like me) write dummy wrappers to support the plugin not crashing on the other platform. On the plugins site it will say this plugin supports both Android and iOS, but in all reality the plugin only really supports iOS, and actually doesn't really do anything on Android. I would like to have the plugins site actually reflect this reality rather than you downloading a plugin you thing works on Android and it turns out it doesn't.
In addition since Angular was introduced to the eco-system, there are a large number of plugins that actually do NOT work with NAN (NativeScript Angular) code. And even some that don't work with PAN (Plain Awesome NativeScript) code. In addition in the future we might get other frameworks supported like VueJS (VAN?), etc.
So I would like to start capturing the data so that we can do these additional cool things. And so I am proposing the following additional OPTIONAL meta data to be added.
will be assumed to be false, unless Angular is detected in the Keywords/name/description.
pan = Plain Awesome NativeScript
Will be assumed to be true.
core3 = Supports NS Core Modules 3.
Will be assumed FALSE if platforms.ios/.android < 3
Will be assumed TRUE if platforms.ios/andorid >= 3.
wrapper = Using a dummy wrapper
Will default to false, use "ios" or "android" to signify platform which is using a wrapper.
This is the category to put the plugin in. Valid categories currently are: "Interface", "Processing", "Templates", "Developer", "Utilities"
I am up for other category suggestions. But at this point these are the primary categories that I use on plugins.nativescript.rocks.
Please note each key is optional; however, your plugin will get extra points for having an category key. And you will LOSE points if we detect a plugin is using a wrapper and you haven't tagged it, as this is a issue the plugin users really hate seeing faulty data about the plugins support.
I would recommend plugin authors start adding this to any releases of there plugins so that we can capture the data. This will become critical with the 3.0 release as a large chunk of plugins are not going to be compatible between NS 2 & NS 3.
For those who haven't deployed any apps in v2.4 of NativeScript; one of the new features that is turned on by default is SnapShots. Now most the time this is a AWESOME thing, however occasionally this can cause issues. For example I have one app of mine that this crashes at startup when using SnapShots.
Now the docs do list how to disable snapshots; but it is a lot easier for me to find the notes on my own site than trying to figure out which doc has the info.
The environmental variable you need to adjust is: <strong>TNS_ANDROID_SNAPSHOT</strong>
I know a wide number of you use TypeScript; well one of the irritations I've had with TypeScript -- I just figured out how to solve. Finally did some research and tests to figure out how to make TypeScript support using ~/ as a normal path for building and determining editor intellisense since this is a special path in NativeScript meaning the home app path. Using this path in a import / require statement means you can do something like this.
import * as animation from '~/support/animation'
and it will load in the file at /app/support/animation
You can use relative paths, but I find absolute path's a lot easier to read and understand exactly which file is being loaded. In addition things like my NativeScript-Updater can't use relative path's (do to some low level issues in the iOS runtimes) and determine if a file has been updated.
Ok, so the solution: open your tsconfig.json file and add the following:
Then you can type tns info and verify that everything says v2.4.x
iOS failing to build, older projects: v2.4 requires you to have the Info.plist file in the app_resources/ios folder. The simplist way to fix this is to create a new project and then replace your app_resources with the new app_resources folder. If you have any resources you have manually added or any changes to any files make sure you copy them out before you delete the old app_resources folder. I would highly recommend you do NOT merge them as you might get some weird behavior from the old resources in the old format vs the new resources in the newer layout.
iOS requires CocoaPods v1.0 or later. This is not a NativeScript issue so much as the Cocoapod infrastructure no longer allows anything older than 1.0..
I've been doing NativeScript for a while; and since I'm a contractor/freelancer; and no specific company pays my salary -- I've decided to start putting some of my cool learned tips into the paid category. Most of these will only qualify if they took me multiple hours to figure out. Unfortunately nobody pays me for fixing things when they break... So, if I can use my hard earned knowledge to save you a vast amount of time, what is it worth to you?
All this knowledge is time tested and can save you a vast amount of diagnostic time on why something doesn't work. So if you think saving you time is worth it; please feel free to sign up and support me; and I will provide the information you need when you need it...
The first series is; NativeScript Platform Differences
You might get an app running perfectly on one platform, and then wonder why it isn't working on the other. I have started out with a cool post on several issues you might have between iOS and Android using HTTP/HTTPS.
The second series is: Troubleshooting your NativeScript
I have started this series out on dealing with Upgrading from NativeScript to 2.4 and issues you might face.
The first post in this series deals with a specific iOS upgrading issue.
The second post in this series deal with a specific Android upgrading issue (Error starts with: Multiple dex files), when using several plugins...
The third series is: Ready to Distribute my app... What now?
The first post in this series deals with a specific iOS Build issues...
The second post in this series deals with a specific iOS Build configuration information.
Some of these posts will be showing up in the next couple day as I have time to finish them off...
And yes; I will continue to post free useful stuff... 😉