无法解析File的所有参数

Syt*_*ham 1 file file-transfer ionic-framework ionic-native

我正在尝试实施https://ionicframework.com/docs/native/file-transfer/

因此我需要安装https://ionicframework.com/docs/native/file/

当我在我的服务中使用"文件"时,我收到错误:

无法解析File的所有参数:(?,?,?,?,?).

我知道问号可能类似于循环引用,我从来没有在其他任何地方使用我的服务,也没有使用过"文件".

import {Injectable} from '@angular/core';
import {File} from "@ionic-native/file";
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';

@Injectable()
export class ImageService {

  constructor(private file: File, private transfer: FileTransfer) {

  }

  public getImagesOfSchedule() {
    const fileTransfer: FileTransferObject = this.transfer.create();
    const url = 'http://techbooster.be/wp-content/uploads/2017/11/logo-long-white.png';
    fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {
      console.log('download complete: ' + entry.toURL());
    }, (error) => {
      // handle error
    });
  }

}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

providers: [
    StatusBar,
    AuthenticationService,
    ScheduleService,
    ToastService,
    StorageService,
    FacebookService,
    GoogleService,
    ImageService,
    Facebook,
    GooglePlus,
    PushService,
    File, <----------------
    FileTransfer, <--------------
    Push,
    ScreenOrientation,
    {
      provide: HttpService,
      useFactory: HttpFactory,
      deps: [XHRBackend, RequestOptions]
    },
    {
      provide: HttpNoAuthService,
      useFactory: HttpFactory,
      deps: [XHRBackend, RequestOptions]
    },
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
Run Code Online (Sandbox Code Playgroud)

Syt*_*ham 8

好的我发现在app.module.ts中自动导入的File类不是:

import { File } from '@ionic-native/file';
Run Code Online (Sandbox Code Playgroud)

相反,它是自动导入的一些标准"lib.es6.d.ts".

因此,请确保导入正确的"文件"类!