I’m using ionic v3 .
I setup facebook plugin and package .
i try to login get this errors
core.js:1449 ERROR Error: Uncaught (in promise): TypeError: Object(…) is not a function
TypeError: Object(…) is not a function
at Facebook.webpackJsonp.486.Facebook.login (index.js:27)
at LoginButtonsComponent. (login-buttons.ts:69)
at step (components.module.ts:26)
at Object.next (components.module.ts:26)
at fulfilled (components.module.ts:26)
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at c (polyfills.js:3)
at polyfills.js:3
at fulfilled (components.module.ts:26)
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
my code is
import { Facebook } from ‘@ionic-native/facebook/ngx’;
async loginWithFacebook() {
console.log(‘www’);
const loading = await this.loadingController.create({
content: ‘Please wait…’
});
await loading.present();
// let permissions = new Array<string>();
//the permissions your facebook app needs from the user
let permissions = [‘public_profile’, ‘user_friends’, ‘email’];
this.fb.login(permissions)
.then((response ) => {
console.log(‘qqq’);
let userId = response.authResponse.userID;
//Getting name and gender properties
this.fb.api("/me?fields=name,email", permissions)
.then(user => {
user.picture = “https://graph.facebook.com/” + userId + “/picture?type=large”;
//let patient = user;
//now we have the users info, let’s save it in the storage
this.restProvider.faceBookLogin(user.email)
.subscribe(res => {
//return from reset api after check patient
let patient = res.data;
this.storage.set(‘token’,
patient.token)
//after successfully save token save patient data
.then(() => {
this.storage.set(‘patient_info’,
{
photo: user.photo,
code: patient.code,
name: user.name,
email: user.email,
facebook: true
})
}).catch(error => console.error(‘Error storing item’, error));
this.navCtrl.setRoot(‘TabsPage’);
loading.dismiss();
}, err => {
loading.dismiss();
console.log(err);
});
})
}, error => {
console.log(error);
loading.dismiss();
});
}