Hitman666 / cordova-ios-voip-push

Register and receive VoIP push notifications in hybrid app projects with Cordova
MIT License
23 stars 28 forks source link

Cannot find module 'cordova-ios-voip-push' #17

Open Haroon6138 opened 4 years ago

Haroon6138 commented 4 years ago

Hi! First of all thanks for the great plugin

I am trying to use this plugin in Ionic 4, Installation went great, i have also followed all the outlined steps as well. But i am unable to use this plugin in my code as it always says that :

Cannot find name 'VoIPPushNotification'

i have tried importing the plugin in my ts file & in my module as well but i keep getting the error:

Cannot find module 'cordova-ios-voip-push'.

I have imported the plugin with both ways:

  1. cordova.plugins.VoIPPushNotification.init();

  2. import { VoIPPushNotification } from "cordova-ios-voip-push";

But none of them seems to work.

Please point me to the correct way ASAP as i need it urgently & any help would be greatly appreciated.

mattkhaw commented 4 years ago

I think this link will address your issue -> How to use cordova custom plugin in ionic

Haroon6138 commented 4 years ago

@mattkhaw this is what i did, i declared the cordova variable, that's how i am using some other cordova plugins in my Ionic app, like cordova-call etc., but still wasn't working

mattkhaw commented 4 years ago

I think you should plug your app into the console and check where VoIPPushNotification is. It shouldn't be using import directive. I think import directive requires a wrapper around it. Is it possible that VoIPPushNotification is in the window variable?

Haroon6138 commented 4 years ago

@mattkhaw i got it to work, now the problem that i am having is the "didUpdatePushCredentials" is never called, hence i am unable to get the token. I have completed all the requirements for this like generating the cert & pem file & everything, but still not working. I also saw ur Github plugin "cordova-plugin-callkit", i tried it but still the same, It would be a huge help if i can get an example for ionic 4.

mattkhaw commented 4 years ago

@Haroon6138 My plugin is the same as @Hitman666's. So, the result would be the same. If you can get it to work, means it will work, otherwise no. If you've setup the Apple Developer console portion, it will work.

What I think is maybe you setup for the wrong app? That might be the answer. If you got the plugin to work, there's no reason it cannot get a token unless the setup is wrong. This is what I've experience setting up not only Apple PushKit but for other frameworks as well. I couldn't help you much on Ionic 4 since I don't use Ionic but Ionic will work similarly with Cordova based on what I've experienced so far. I did do some Ionic stuff previously, so that's why I said it is similar to Cordova.

My suggestion is double check the bundle ID and make sure VOIP services is enabled for that app. That's the only problem I see so far. The other possibility is on the native side, maybe there's some capabilities that you haven't enable yet. Make sure VOIP and remote notifications are enabled.

Haroon6138 commented 4 years ago

@mattkhaw i'll check all the configurations again But i am sure that i have done them all correctly as i have followed the instructions from around 8 10 tutorials

ganeshpotnuru commented 4 years ago

@Haroon6138 , can you post your answer here, what you did to resolve the issue "Cannot find name 'VoIPPushNotification'"