SergeyMell / nativescript-plugins

Apache License 2.0
14 stars 4 forks source link

App runs on simulator but crashes on device: SVGKFastImageView is not defined #18

Open timoschlueter opened 3 years ago

timoschlueter commented 3 years ago

Hello everyone,

first of all: Thank you for this amazing plugin. I am using it in production for about a year now and havent had any issue with it. Today, i started porting one of my apps from NativeScript 7 to NativeScript 8 using ns migrate and updating most of my dependencies. The app itself starts and works fine on the iOS 14.6 simulator. Unfortunately, the app crashes on a real device as soon as i enter a view using the -tag. The app is based on Angular 11 and used to run just fine with NativeScript 7 on the simulator as well as on device.

Is this a known issue? Did i miss something when migrating to NativeScript 8? Again, the app launches without any problems but crashes on the device as soon as i enter the view that displays a SVG.

Here are the details from the console:

*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught ReferenceError: SVGKFastImageView is not defined
 at 
    SVGImage(file:///var/containers/Bundle/Application/DB866575-B368-4ADF-84DE-EB1E1F9ACE47/szfgmbkweb.app/app/vendor.js:158559:27)
    at createView(file:///var/containers/Bundle/Application/DB866575-B368-4ADF-84DE-EB1E1F9ACE47/szfgmbkweb.app/app/vendor.js:104398:22)
    at createElement(file:///var/containers/Bundle/Application/DB866575-B368-4ADF-84DE-EB1E1F9ACE47/szfgmbkweb.app/app/vendor.js:104598:30)

The dependencies i am using are:


"dependencies": {
    "@angular/animations": "~11.2.10",
    "@angular/cdk": "~11.2.8",
    "@angular/common": "~11.2.10",
    "@angular/compiler": "~11.2.10",
    "@angular/core": "~11.2.10",
    "@angular/forms": "~11.2.10",
    "@angular/platform-browser": "~11.2.10",
    "@angular/platform-browser-dynamic": "~11.2.10",
    "@angular/router": "~11.2.10",
    "@danvick/ngx-translate-nativescript-loader": "^3.0.1",
    "@fortawesome/fontawesome-pro": "^5.15.0",
    "@nativescript-community/ui-lottie": "~1.0.0",
    "@nativescript/angular": "~11.8.0",
    "@nativescript/appversion": "^2.0.0",
    "@nativescript/core": "~8.0.0",
    "@nativescript/iqkeyboardmanager": "~2.0.0",
    "@nativescript/theme": "~3.0.1",
    "@ngx-translate/core": "^13.0.0",
    "@nstudio/nativescript-loading-indicator": "^4.0.0",
    "@sergeymell/nativescript-svg": "^1.1.1",
    "core-js": "^3.10.1",
    "date-fns": "^2.20.0",
    "jwt-decode": "^3.1.2",
    "nativescript-barcodescanner": "^4.0.1",
    "nativescript-carousel": "~7.0.1",
    "nativescript-feedback": "^2.0.0",
    "nativescript-lottie": "~5.0.2",
    "nativescript-numeric-keyboard": "^5.0.0",
    "nativescript-ui-listview": "^9.1.0",
    "nativescript-vibrate": "^4.0.1",
    "reflect-metadata": "~0.1.13",
    "rxjs": "~6.6.7",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
timoschlueter commented 3 years ago

I found the solution a few minutes ago: Downgrading SVGKit to 2.1.1 fixes the problem.

In my project, i added the following line to the Podfile under _AppResources/iOS

pod 'SVGKit', '~> 2.1.0'

Since this causes a dependency conflict with the Podfile thats included in this plugin, i also removed the Podfile that comes with this plugin from within our building pipeline.

This is very hacky and should not be the final solution.

@SergeyMell do you have any plans looking into this? I will assist as best as i can if you need any help reproducing the steps that i took to fix this problem.

SergeyMell commented 3 years ago

Hello @timoschlueter and thank you for the issue. That looks a bit strange because I've tested this plugin on one NS8 project and it worked ok. The first thing that I'd advise is to remove all the platforms, node modules, and hooks after you finished the migration

rm -rf platforms node_modules hooks

and reinstall the dependencies

npm i

Please, let me know if it helps. If not, I'll recheck the plugin work for NS8 during this weekend and see what happens

SergeyMell commented 3 years ago

@timoschlueter did you have a chance to check my advice? Did it work?

timoschlueter commented 3 years ago

@SergeyMell not yet. I will try it and get back to you as soon as I can. Thanks for the advice!