techaffinity / freshchat-phonegap

Freshchat sdk for phonegap
7 stars 36 forks source link

Plugin initialisation failure #39

Open bioyeneye opened 5 years ago

bioyeneye commented 5 years ago

After Installing the plugin, when I tried to initialise the plugin from app.component.ts I am getting this error:

Code:

(window as any).Freshchat.init({
          appId       :"*************",
          appKey      : "***********",
          cameraCaptureEnabled    : true,
          gallerySelectionEnabled : true,
          notificationSoundEnabled:true,
          teamMemberInfoVisible:true,
          showNotificationBanner:true,

      }, function(success){
        console.log("success"+ success);});

Error: Uncaught (in promise): TypeError: Cannot read property 'init' of undefined TypeError: Cannot read property 'init' of undefined at http://localhost:8101/build/main.js:360:30 at t.invoke (http://localhost:8101/build/polyfills.js:3:14976) at Object.onInvoke (http://localhost:8101/build/vendor.js:5134:33) at t.invoke (http://localhost:8101/build/polyfills.js:3:14916) at r.run (http://localhost:8101/build/polyfills.js:3:10143) at http://localhost:8101/build/polyfills.js:3:20242 at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15660) at Object.onInvokeTask (http://localhost:8101/build/vendor.js:5125:33) at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15581) at r.runTask (http://localhost:8101/build/polyfills.js:3:10834)

techaffinity commented 5 years ago

This issue might occur during improper installation of plugin during the platform set up so we have to completely remove the plugin/platform and reinstall again.

Please find the following steps to solve the issue.

For IOS

Step 1 - Remove and add Cordova plugin.

Please run the following commands

cordova plugin rm cordova-plugin-freshchat cordova platform rm ios cordova platform add ios cordova plugin add https://github.com/techaffinity/freshchat-phonegap.git

Step 2 - You need to add the CocoaPods into your project folder (platforms/ios) using the below command. pod update

For ANDROID

Step 1 - Remove and add Cordova plugin.

Please run the following commands

cordova plugin rm cordova-plugin-freshchat cordova platform rm android cordova platform add android cordova plugin add https://github.com/techaffinity/freshchat-phonegap.git