我尝试在 ionic 2 应用程序中登录 facebook,但在构建我的应用程序时遇到此错误。
帮我解决这个问题。
[13:17:52] 转译开始... [13:17:58] 打字稿:
D:/royalworkspace/newfblogin/node_modules/@ionic-native/facebook/index.d.ts,
线路:1
模块'“D:/royalworkspace/newfblogin/node_modules/@ionic-native/core/index”'
没有导出成员
'IonicNativePlugin'。
L1: import { IonicNativePlugin } from '@ionic-native/core';
L2: export interface FacebookLoginResponse {
-- 主页.ts --
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private facebook: Facebook ) {
}
Login(){
this.facebook.login(['email']).then((Response) =>{
alert('loged in');
alert(JSON.stringify(Response.authResponse));
},(error) => {
alert(error);
})
}
LoginDetails(){
this.facebook.getLoginStatus().then((response) => {
if (response.status == "connected") {
this.facebook.api('/' + response.authResponse.userID + '?fields=id,name,gender', []).then((response) =>{
alert(JSON.stringify(response));
}, (error) =>{
alert(error);
})
}
else{
alert('not loged in');
}
})
}
Logout(){
this.facebook.logout().then((Response) => {
alert(JSON.stringify(Response));
}, (error) =>{
alert(error);
})
}
}
-- home.html --
<ion-content padding>
<button ion-button outline (click)="Login()">Login</button>
<button ion-button outline (click)="LoginDetails()">Login Details</button>
<button ion-button outline (click)="Logout()">Logout</button>
</ion-content>
-- 应用程序模块 --
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,Facebook,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}