I have created fab list for inviting people through social media apps. When anyone clicks on say “FaceBook” button, one should have access to friend list and be able to send app invite or link to selected. I am using App link/ App invitation for that. While clicking on “facebook” button, I am receiving below error:
error_handler.js:60 TypeError: Cannot read property ‘appInvite’ of undefined
at PrimaryCaregiversPage.fbInvite (primary-caregivers.ts:61)
at CompiledTemplate.proxyViewClass.View_PrimaryCaregiversPage0.handleEvent_44 (/AppModule/PrimaryCaregiversPage/component.ngfactory.js:1070)
at CompiledTemplate.proxyViewClass. (view.js:664)
at HTMLButtonElement. (dom_renderer.js:489)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (ng_zone.js:264)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at HTMLButtonElement.invoke (polyfills.js:3)
Note: I am testing this through http server.
Can you post the code of this method?
Here, fbInvite() is a click method for button.
fbInvite(){
this.facebookConnectPlugin.appInvite(
{
url: "https://myfbappurl",
picture: "http://example.com/image.png"
},
function(postId){
if(postId) {
if(postId.completionGesture == "cancel") {
console.log("Cancel");
console.log(postId);
} else {
console.log("Browse");
}
} else {
// user just pressed done, bad guy
}
},
function(error){
// error
console.log(error);
}
);
}
I think you forgot to import the module in your app.module.ts!
import { Facebook } from ‘@ionic-native/facebook’;
I have already imported the module in app.module.ts.
I am not sure if my code mentioned is correct for applink/ app inivte. Let me know if this is the only method in typescript.
It have to look like this in your *.module.ts
import { Facebook } from '@ionic-native/facebook';
constructor(private fb: Facebook) {
this.fb.appInvite(options, options.url, options.picture)
}
I can’t see any differences in the documentation: https://ionicframework.com/docs/native/facebook/
Not working. received below error.
typescript: src/pages/invite-people/invite-people.ts, line: 61
Supplied parameters do not match any signature of call target.
L61: **this.fb.appInvite(**
Quick question: is there anyway to test applink without hosting the app?