Ошибка вызова js метода onCreateView System.err: TypeError: правая часть instanceof не является объектом Nativescript - PullRequest
1 голос
/ 06 мая 2020

Я пытаюсь использовать AppSyn c в моем приложении Nativescript. Это ссылка, по которой я следую

https://market.nativescript.org/plugins/nativescript-app-sync

После этой ссылки выше у меня есть код, который проверяет, обновлено ли приложение или нет

Каждый раз, когда я добавляю этот код

AppSync.sync({
    deploymentKey: isIOS ? "my-ios-deployment-key" : "my-android-deployment-key",
    installMode: InstallMode.ON_NEXT_RESUME, // this is the default install mode; the app updates upon the next cold boot (unless the --mandatory flag was specified while pushing the update)
    mandatoryInstallMode: isIOS ? InstallMode.ON_NEXT_RESUME : InstallMode.IMMEDIATE, // the default is InstallMode.ON_NEXT_RESUME which doesn't bother the user as long as the app is in the foreground. InstallMode.IMMEDIATE shows an installation prompt. Don't use that for iOS AppStore distributions because Apple doesn't want you to, but if you have an Enterprise-distributed app, go right ahead!
    updateDialog: { // only used for InstallMode.IMMEDIATE
        updateTitle: "Please restart the app", // an optional title shown in the update dialog
        optionalUpdateMessage: "Optional update msg",   // a message shown for non-"--mandatory" releases
        mandatoryUpdateMessage: "Mandatory update msg", // a message shown for "--mandatory" releases
        optionalIgnoreButtonLabel: "Later", // if a user wants to continue their session, the update will be installed on next resume
        mandatoryContinueButtonLabel: isIOS ? "Exit now" : "Restart now", // On Android we can kill and restart the app, but on iOS that's not possible so the user has to manually restart it. That's why we provide a different label in this example.
        appendReleaseDescription: true // appends the description you (optionally) provided when releasing a new version to AppSync
    } });

, я всегда вижу эту ошибку

System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onCreateView failed
System.err: TypeError: Right-hand side of 'instanceof' is not an object
System.err:
System.err: StackTrace:
System.err: (file: node_modules\@nativescript\core\ui\layouts\flexbox-layout\flexbox-layout.android.js:14:14)
System.err:     at applyAllNativeSetters(file: node_modules\@nativescript\core\ui\core\properties\properties.js:1065:37)
System.err:     at initNativeView(file: node_modules\@nativescript\core\ui\core\properties\properties.js:992:8)
System.err:     at ViewBase.onResumeNativeUpdates(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:647:21)
System.err:     at ViewBase._resumeNativeUpdates(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:278:17)
System.err:     at ViewBase.onLoaded(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:232:13)
System.err:     at View.onLoaded(file: node_modules\@nativescript\core\ui\core\view\view.android.js:249:34)
System.err:     at (file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:317:89)
System.err:     at ViewBase.callFunctionWithSuper(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:310:8)
System.err:     at ViewBase.callLoaded(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:317:13)
System.err:     at ViewBase.loadView(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:456:17)
System.err:     at (file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:234:18)
System.err:     at ContentView.eachChildView(file: node_modules\@nativescript\core\ui\content-view\content-view.js:70:12)
System.err:     at PageBase.eachChildView(file: node_modules\@nativescript\core\ui\page\page-common.js:126:39)
System.err:     at ViewCommon.eachChild(file: node_modules\@nativescript\core\ui\core\view\view-common.js:925:13)
System.err:     at ViewBase.onLoaded(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:233:13)
System.err:     at View.onLoaded(file: node_modules\@nativescript\core\ui\core\view\view.android.js:249:34)
System.err:     at Page.onLoaded(file: node_modules\@nativescript\core\ui\page\page.android.js:43:34)
System.err:     at (file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:317:89)
System.err:     at ViewBase.callFunctionWithSuper(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:310:8)
System.err:     at ViewBase.callLoaded(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:317:13)
System.err:     at ViewBase.loadView(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:456:17)
System.err:     at ViewBase._addViewCore(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:451:17)
System.err:     at ViewBase._addView(file: node_modules\@nativescript\core\ui\core\view-base\view-base.js:437:13)
System.err:     at FragmentCallbacksImplementation.onCreateView(file: node_modules\@nativescript\core\ui\frame\frame.android.js:700:18)
System.err:     at FragmentClass.onCreateView(file: node_modules\@nativescript\core\ui\frame\fragment.android.js:29:37)
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err:     at com.tns.FragmentClass.onCreateView(FragmentClass.java:53)
System.err:     at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
System.err:     at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
System.err:     at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
System.err:     at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
System.err:     at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
System.err:     at android.os.Handler.handleCallback(Handler.java:751)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
System.err:     at android.os.Looper.loop(Looper.java:154)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6119)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Но всякий раз, когда вышеприведенная строка закомментирована, приложение работает отлично

Что мне здесь не хватает

Пожалуйста, помогите мне

мой пакет. json выглядит так

"tns-ios": {
      "version": "6.5.0"
    },
    "tns-android": {
      "version": "6.5.0"
    }
  },
  "dependencies": {
    "@nativescript/theme": "~2.3.3",
    "nativescript-vue": "~2.5.0",
    "nativescript-webrtc-plugin": "^2.0.0-alpha.19",
    "nativescript-app-sync": "^2.0.0",
    "tns-core-modules": "~6.5.0",
    "@nstudio/nativescript-pulltorefresh": "^1.1.1",
    "axios": "^0.19.2",
    "country-code-info": "^0.3.0",
    "firebase": "^7.14.2",
    "firebase-admin": "^8.11.0",
    "libphonenumber-js": "^1.7.51",
    "mathjs": "^6.6.5",
    "nativescript-activity-detection": "^0.1.1",
    "nativescript-contacts-lite": "^0.2.6",
    "nativescript-exit": "^1.0.1",
    "nativescript-geolocation": "^5.1.0",
    "nativescript-headset-detection": "^1.0.0",
    "nativescript-local-notifications": "^4.2.1",
    "nativescript-permissions": "^1.3.9",
    "nativescript-plugin-firebase": "^10.5.2",
    "nativescript-social-share": "^1.6.0",
    "nativescript-socketio": "^3.3.1",
    "nativescript-toast": "^2.0.0",
    "vuex": "^3.3.0"
  },
  "devDependencies": {
    "@babel/core": "~7.1.0",
    "@babel/preset-env": "~7.1.0",
    "babel-loader": "~8.0.0",
    "nativescript-dev-webpack": "~1.5.1",
    "nativescript-vue-template-compiler": "~2.5.0",
    "node-sass": "^4.7.1",
    "@types/node": "^13.13.4",
    "dotenv": "^8.2.0",
    "nativescript-worker-loader": "^0.11.0",
    "tns-platform-declarations": "^6.5.1",
    "typescript": "^3.8.3",
    "vue": "^2.6.11",
    "vue-loader": "^15.9.2"
  },
  "prettier": {
    "trailingComma": "es5",
    "tabWidth": 2,
    "semi": false,
    "singleQuote": true,
    "bracketSpacing": true,
    "arrowParens": "avoid",
    "printWidth": 120
  }

1 Ответ

1 голос
/ 05 августа 2020

Go на @nativescript/core/ui/layouts/flexbox-layout/flexbox-layout.android.js

Замените:

var widgetFlexboxLayout;
var widgetLayoutParams;

на

let widgetFlexboxLayout= org.nativescript.widgets.FlexboxLayout;
let widgetLayoutParams= org.nativescript.widgets.FlexboxLayout.LayoutParams;
...