I'm developing push notifications in an Ionic app, my issue is that I can't see the users in OneSignal and send notifications. The only log that I have in xCode console is:
appId set, but please call setLaunchOptions(launchOptions) to complete OneSignal init!
This is my info:
Ionic:
Ionic CLI : 5.4.16
Ionic Framework : @ionic/angular 5.7.0
@angular-devkit/build-angular : 12.0.5
@angular-devkit/schematics : 12.0.5
@angular/cli : 12.0.5
@ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.1.1
@capacitor/core : 3.2.2
Cordova:
Cordova CLI : 6.2.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (1 plugins total)
Utility:
cordova-res : 0.15.3
native-run : 1.4.1
System:
ios-sim : ios-sim/9.0.0 darwin-x64 node-v12.18.4
NodeJS : v12.18.4 (/usr/local/bin/node)
npm : 6.14.8
OS : macOS Big Sur
Xcode : Xcode 12.5.1 Build version 12E507
In android I'm getting the same error.
This warning is informative and does not affect the plugin functionality.
You can find the code that generates this warning in OneSignal.m
file of the OneSignal iOS framework that Plugin depends on. It happens either when the appId
is set repeatedly or when the appId
is being set, but launchOptions
object has not yet been initialized.
If you look at the Plugin source files and the initialization function, you will see that it does call setLaunchOptions(launchOptions)
after setting appId
:
NSString* appIdStr = (appId ? [NSString stringWithUTF8String: appId] : nil);
[OneSignal setMSDKType:@"cordova"];
[OneSignal setAppId:appIdStr];
[OneSignal initWithLaunchOptions:launchOptions];
The code above triggers the warning at [OneSignal setAppId:appIdStr]
but then immediately addresses it with [OneSignal initWithLaunchOptions:launchOptions]
(which is the Objective-C function underlying the setLaunchOptions(launchOptions)
Swift interface).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With