我正在使用ionic 4
和ftp
插件
这是我的应用程序模块:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { FTP } from '@ionic-native/ftp/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
FTP,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
然后这是我的home.page.html:
<ion-header>
<ion-toolbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="ion-padding">
<h2>{{ title }}</h2>
<div>
<h4>Success Message: {{ successMessage }}</h4>
</div>
<hr>
<div>
<h4>Fail Message: {{ failMessage }}</h4>
</div>
The world is your oyster.
<p>If you get lost, the <a target="_blank" rel="noopener" href="https://ionicframework.com/docs/">docs</a> will be your guide.</p>
</div>
</ion-content>
最后是我的home.page.ts:
import { Component } from '@angular/core';
import { FTP } from '@ionic-native/ftp/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
title = 'Test';
successMessage = '';
failMessage = '';
constructor(private ftp: FTP) {
this.ftp.connect('ftp_host', 'ftp_user', 'ftp_password')
.then((res: any) => {
console.log('Login successful', res);
this.successMessage = `Login successful - ${res}`;
})
.catch((error: any) => {
console.error(error);
this.failMessage = `Error - ${error}`;
});
}
}
问题是,当我运行它时(也在IOS / Xcode Simulator
和Device
上运行它)。我尝试运行prepare,以便它进行更新,但仍然存在相同的错误。我不断得到:
Error - plugin_not_installed.
我该如何解决?有什么想法吗?