Troubleshooting Cordova

Common issues on Cordova.

👍

Activate logging when troubleshooting

You can activate WonderPush logs by simply calling WonderPush.setLogging(true).

Our logs report pretty much the entire activity of our SDK. They are all prefixed with [WonderPush] so they're easy to filter in and out.

Don't forget to turn them off in your release build.

Automatic signing and provisioning profile errors

If you run into the following error:

Provisioning profile "XXX" has app ID "YYY", which does not match the bundle ID "YYY.WonderPushNotificationServiceExtension".

We recommend using Cordova's build.json file to configure automatic provisioning using "automaticProvisioning": true under both ios.debug and ios.release.
This will help you avoid inappropriate provisioning profile for the Notification Service Extension, especially with your CI/CD automated build tools.

If you've already added the SDK to your app and still get an error, delete your platforms/ios folder and run cordova prepare ios to recreate it.

Firebase conflicts

Notification clicks not shown on dashboard, universal links stop working

If your iOS app ships with Firebase, make sure Firebase's AppDelegate proxy is disabled by setting FirebaseAppDelegateProxyEnabled to NO in your MyApp-Info.plist file (adapt MyApp), as explained in the Firebase documentation.

In addition, some plugins do take over push notifications in a very agressive way, like dpa99c/cordova-plugin-firebasex. To fix:

  1. Remove the WonderPush plugin:
cordova plugin rm wonderpush-cordova-sdk --variable CLIENT_ID= --variable CLIENT_SECRET=
  1. Add it again with the AUTO_INIT=false option (adapt YOUR_CLIENT_ID and YOUR_CLIENT_SECRET):
cordova plugin add wonderpush-cordova-sdk --variable CLIENT_ID=YOUR_CLIENT_ID --variable CLIENT_SECRET=YOUR_CLIENT_SECRET AUTO_INIT=false
  1. Open platforms/ios/MyApp/Classes/AppDelegate.m (adapt MyApp) and add the following (adapt YOUR_CLIENT_ID and YOUR_CLIENT_SECRET):
#import <WonderPush/WonderPush.h>
  
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions {
    [WonderPush setClientId:@"YOUR_CLIENT_ID" secret:@"YOUR_CLIENT_SECRET"];
    [WonderPush setupDelegateForApplication:application];
    [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:nil usingBlock:^(NSNotification *note){
        [WonderPush setupDelegateForUserNotificationCenter];
    }];
    return YES;
}