Ionic Pro packaging for iOS fails when adding onesignal

I’m trying to build a cross platform app without a mac. I’m having no problems with Android. I’ve spent several hours or so dealing with iOS certificates with OpenSSL After this confusing process. I’ve managed to narrow down my problems to this last part. The app won’t package for iOS.

Relevant portion of the build log:

Installing “onesignal-cordova-plugin” for ios
Failed to install ‘onesignal-cordova-plugin’:undefined Failed to restore plugin “onesignal-cordova-plugin” from config.xml. You might need to try adding it again.
Error: CocoaPods was not found. Please install version 1.0.1 or greater from

and a bit further down the build log…

[00:03:31]: ▸ e[35mIn file included from /Users/ionic/builds/f44814b7/0/project-1/platforms/ios/MyOLS/Plugins/onesignal-cordova-plugin/OneSignalPush.m:31:e[0m [00:03:31]:
▸ e[35m/Users/ionic/builds/f44814b7/0/project-1/platforms/ios/MyOLS/Plugins/onesignal-cordova-plugin/OneSignalPush.h:32:9: fatal error: ‘OneSignal/OneSignal.h’ file not founde[0m [00:03:31]:
▸ e[35m#import <OneSignal/OneSignal.h>e[0m [00:03:31]:
▸ e[35m ^e[0m [00:03:31]: ▸ e[35m1 error generated.e

Any way around this without using a Mac?

Perhaps there’s a way to get the compiler to install cocoapods?
Or I could use a virtual machine…

Dont use the latest one signal, use the second last it works with that

1 Like

The missing Cocoapods problem on Ionic Pro was written about a few times here in the forum already, but I don’t think anyone came back with a solution yet. But you might want to search for “Ionic Pro” anyway and read through the posts that pop up.

And you best as Ionic support:
Please report back when you get a response or solution.

Which version? I tried onesignal-cordova-plugin@2.1.2 and got the same error

Read somewhere 2.1.0 should have worked. I tried that and it didn’t. Anyway I realized because I was using ionic-native/Onesignal instead of onesignal-cordova-plugin, I did not actually need the plugin. It finally built without the dependencies.

Ionic Native Onesignal is just a plugin on top of the Cordova plugin (that makes using the Cordova plugin a bit nicer) and should in no way have any problems with Ionic Pro. Great that it works for you now, but probably not caused by removing the Ionic Native plugin.

To be clear, I removed onesignal-cordova-plugin and the iOS build worked without it.
Now when I put it on my iPad I get a blank white screen after the splash. And since I don’t have a Mac I can’t debug it So much for that.

Oh wait the cordova plugin is required for ionic native? Hold hold on is something weird with my setup then?

Yes, the Ionic Native plugin just makes the Cordova plugin more usable. When the Cordova plugin is missing, the Ionic Native plugin will try to call it and possibly crash. You want either both or none of them installed at the same time.

Okay well with access to a Mac I can see the errors now. After having some trouble with building it with Xcode, Safari remote debugger is telling me onesignal-cordova-plugin is not installed, even though I added it back in. Did some searching and I did pod install on the platforms/ios folder, then added OneSignal.framework to the linked binaries in xcode, but the error still shows.

Once I run the app the errors don’t show and it stays on the blank screen. The errors only show after I hit refresh.

I finally solved it. The Safari console was telling me onesignal-cordova-plugin was not installed, but it was. The code initializing OneSignal has to go inside the this.platform.ready() promise. I had mine in the constructor. So something like this.

initializeApp() {
        this.platform.ready().then(() => {
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            if ('cordova')) {
                /*Onesignal id and firebase id*/
                this.oneSignal.startInit('onesignal-id', 'google-id');
                this.oneSignal.handleNotificationReceived().subscribe((message) => {
                    // do something when notification is received
                this.oneSignal.handleNotificationOpened().subscribe(() => {
                    // do something when a notification is opened