nativescript-webview-interface не работает в Ios для Nativescript 6.1.2 - PullRequest
0 голосов
/ 18 октября 2019

Поскольку я перешел на NativeScript 6.1.2, веб-просмотр не работает в IOS с использованием плагина nativescript-webview-interface, он дает мне следующую ошибку

this.view.ios.configuration ОШИБКА TypeError:undefined не является объектом (оценивается как '_this.view.ios.configuration')

Обновлен плагин до последней версии 1.4.3, но по-прежнему выдается та же ошибка. Я искал какое-то исправление по этому поводу, но мне все равно ничего не помогло решить его, я просто нашел похожую проблему в github для плагина, но она все еще не имеет решения:

WebViewОшибка элемента undefined не является объектом (оценивается функция this.oLangWebViewInterface.callJSFunction, предоставленная пользователем BJacob7.

Код webview.component.html:

<web-view  (loadded)="" [visibility]="visibility ? 'visible' : 'collapsed'" height="100%" width="100%" padding="0" margin="0" touch="webviewtouch"
    pan="webviewpan" #webView>
</web-view>

Код веб-просмотра. component.ts: {

import {
    Component,
    ViewChild,
    ElementRef,
    AfterViewInit,
    OnDestroy,
    OnInit,
    NgZone,
} from '@angular/core';
import { WebView, LoadEventData } from 'tns-core-modules/ui/web-view';

export class WebViewComponent implements AfterViewInit, OnDestroy, OnInit {

    @ViewChild("webView", { read: ElementRef, static: false }) webView: ElementRef;
    private webViewInterface;

   ngAfterViewInit() { // Start 

        let webView: WebView = this.webView.nativeElement;
        let urlWebView = Here set Url App

        //At this point in the code the error occurs, only in IOS, 
        //Android works well 
        this.webViewInterface = new 
           webViewInterfaceModule.WebViewInterface(
            webView,
            urlWebView
        );


       if (this.isIos) {
            webView.ios.scrollView.bounces = false;
            webView.ios.allowsBackForwardNavigationGestures = false;
            webView.ios.contentMode = UIViewContentMode.ScaleToFill;
            webView.ios.configuration.userContentController.removeAllUserScripts();
        }


        webView.on(WebView.loadStartedEvent, (args: LoadEventData) => {
          ......

        }

        webView.on(WebView.loadFinishedEvent, (args: LoadEventData) => {
      .......

}


   } // End

}

MacBook-Pro: appcase avogt $ tns info ✔ Получение информации о версиях компонентов NativeScript ... native nativescript компонента имеет версию 6.1.2 и является актуальной. dateКомпонент tns-core-modules имеет версию 6.1.2 и является актуальной. ✔ Компонент tns-android имеет версию 6.1.2 и является актуальной. ✔ Компонент tns-ios имеет версию 6.1.1 и является актуальной.

MacOS Catalina версия 10.15

Ошибка в IOS: файл журнала CONSOLE: ///app/bundle.js: 1883: 24: Antes de new webViewInterface 2019-10-17 19: 27: 38.677130-0300 appcase [1051: 268404] КОНСOLE ERROR file: ///app/vendor.js: 41340: 24: ERROR TypeError: undefined не является объектом (оценивается как this.webView.ios.configuration)

Плагин версии nativescript-webview-interface 1.4.1 Я также использовал версию 1.4.3, и она выдала похожую ошибку.

  "dependencies": {
    "@angular/animations": "8.0.0",
    "@angular/common": "8.0.0",
    "@angular/compiler": "8.0.0",
    "@angular/core": "8.0.0",
    "@angular/forms": "8.0.0",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "8.0.0",
    "@angular/platform-browser-dynamic": "8.0.0",
    "@angular/router": "8.0.0",
    "base-64": "^0.1.0",
    "force": "0.0.3",
    "fs-extra": "^4.0.2",
    "jsrsasign": "^8.0.8",
    "nativescript": "^6.1.2",
    "nativescript-angular": "8.0.2",
    "nativescript-appversion": "^1.4.1",
    "nativescript-barcodescanner": "^2.5.4",
    "nativescript-camera": "file:plugins/nativescript-camera-3.0.1.tgz",
    "nativescript-contacts-lite": "file:plugins/nativescript-contacts-lite",
    "nativescript-exit": "^1.0.1",
    "nativescript-fingerprint-auth": "file:plugins/nativescript-fingerprint-auth/dist",
    "nativescript-geolocation": "5.1.0",
    "nativescript-gif": "^4.0.0",
    "nativescript-https": "file:plugins/nativescript-https/dist",
    "nativescript-imagepicker": "^6.0.1",
    "nativescript-permissions": "^1.2.3",
    "nativescript-plugin-firebase": "file:plugins/nativescript-plugin-firebase-10.0.2.tgz",
    "nativescript-push-notifications": "~1.0.0",
    "nativescript-rootbeer": "file:plugins/nativescript-rootbeer/dist",
    "nativescript-safetynet-helper": "^0.1.1",
    "nativescript-screenshot": "0.0.2",
    "nativescript-secure-storage": "^2.1.1",
    "nativescript-sms-inbox": "^1.0.6",
    "nativescript-social-share": "file:plugins/nativescript-social-share",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-unit-test-runner": "0.7.0",
    "nativescript-vt-token-plugin": "file:plugins/nativescript-vt-token-plugin",
    "nativescript-webview-interface": "file:plugins/nativescript-webview-interface",
    "reflect-metadata": "~0.1.8",
    "rxjs": "6.3.3",
    "rxjs-compat": "^6.2.2",
    "tns-core-modules": "^6.1.2",
    "uglifyjs-webpack-plugin": "^1.1.8",
    "zone.js": "0.9.1"
  },

Мне нужна ваша помощь, чтобы найти решение моей проблемы. Спасибо.

...