TransWikia.com

Marketing Cloud cordova plugin error can not enablePush - iOS

Salesforce Asked by WowowJediPushing on November 8, 2021

so i wanted to create a cordova hybrid app using SalesforceMobileSDK alongside MarketingCloud plugin for push notification. I’ve added SalesforceMobileSDK cordova plugin and so far it runs perfectly. I also succesfully added MarketingCloud plugin into the project, but i still can’t get it to work.

I’ve done all the setup required on Marketing Cloud side and implemented the code to my app and some function like MCCordovaPlugin.isPushEnabled is working seemingly fine. But everytime i called MCCordovaPlugin.enablePush, it doesn’t return anything. Furthermore, everytime i run the app, it display a pop up that says it failed configureSDKwithAppID.

Here is the XCode log:

2018-03-06 17:06:45.971402+0700 Test[22207:348577] initiate MCCordovaPlugin
2018-03-06 17:06:45.971557+0700 Test[22207:348577] MCCordovaPlugin :  [object Object]
2018/03/06 10:06:45.999 Test[22207:7c0b] DEBUG com.salesforce: webView:shouldStartLoadWithRequest:navigationType: Loading URL 'file:///Users/Wowow/Library/Developer/CoreSimulator/Devices/2C443269-FD84-44B4-BCD7-16289631BC62/data/Containers/Bundle/Application/3B830487-9AF7-4EE6-BB86-6118C4A8F96A/Test.app/www/index.html#/landing-page'
2018-03-06 17:06:46.000065+0700 Test[22207:348577] success isPushEnabled at appcomp
2018-03-06 17:06:46.002766+0700 Test[22207:348577] false
2018-03-06 17:06:46.002912+0700 Test[22207:348577] success getSystemToken
2018-03-06 17:06:46.005290+0700 Test[22207:348577] null
2018-03-06 17:06:47.859710+0700 Test[22207:348682] [BoringSSL] Function boringssl_session_errorlog: line 2871 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert
2018-03-06 17:06:47.860121+0700 Test[22207:348682] [BoringSSL] Function boringssl_session_errorlog: line 2871 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert
2018-03-06 17:07:45.976141+0700 Test[22207:348577] foundation version = 1450.000000

Here is the code snippet, the MCCordovaPlugin.isPushEnabled and MCCordovaPlugin.getSystemToken get success message while MCCordovaPlugin.enablePush doesn’t appear on Log:

console.log("initiate MCCordovaPlugin");
console.log("MCCordovaPlugin : ",MCCordovaPlugin);

MCCordovaPlugin.enablePush(success => {
    console.log("success enable push get");
    console.log(success);
}, error =>{
    console.log("error enable push get");
    console.log(error);
});

MCCordovaPlugin.isPushEnabled((success)=>{
    console.log("success isPushEnabled at appcomp");
    console.log(success);
}, (error) => {
    console.log("error isPushEnabled at appcomp");
    console.log(error);
});

MCCordovaPlugin.getSystemToken((success)=>{
    console.log("success getSystemToken");
    console.log(success);
}, (error) => {
    console.log("error getSystemToken");
    console.log(error);
});

Here is the Screenshot of popup:

I am using Cordova 7.0.0, Cordova iOS 4.5.4, Java 1.8.0, SalesforceMobileSDk 5.3.0, and MC Cordova Plugin 1.0.2.

I also found another similar question, though it only has answers for Android so far:
Marketing Cloud Cordova Plugin Push Notification Issue – iOS and Android

Any idea on how i can get this to work, guys?
Thanks.

Regards.

2 Answers

One thing you can try is to see if you have plugin conflict 1) Uninstall sdk plugin and install MC Cordova Plugin and see if it works. (I've had few issues with other plugins but around Android not ios).

Answered by Serge Tk on November 8, 2021

It looks like the configureSDKwithAppID is being called twice. Are you switching AppIDs? For instance, if you are switching between development and production environments and switching config values, you are probably calling the configureSDKwithAppID twice and will need to delete the app on your device and start over with the new appID.

The configureSDKwithAppID is called by our SDK and should not be called necessarily by the user's app.

Answered by Tom Brooks on November 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP