Failed to install 'wonderpush-cordova-sdk

Hello,

I try to use WonderPush on an Ionic 3 project.
When I enter the install command cordova plugin add wonderpush-cordova-sdk --variable CLIENT_ID=XXX --variable CLIENT_SECRET=YYY --variable SENDER_ID=ZZZ I get this alert in VS Code :
Plugin “wonderpush-cordova-sdk” already installed on android.
Plugin “wonderpush-cordova-sdk” already installed on browser.
Installing “wonderpush-cordova-sdk” for ios
Failed to install ‘wonderpush-cordova-sdk’: undefined
CordovaError: Promise rejected with non-error: ‘/usr/local/bin/pod: /usr/local/Cellar/cocoapods/1.7.5/libexec/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory\n/usr/local/bin/pod: line 2: /usr/local/Cellar/cocoapods/1.7.5/libexec/bin/pod: Undefined error: 0\n’
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
at process._tickCallback (internal/process/next_tick.js:68:7)

Can someone help me please ?

Hi Stéphane,

It looks like your Cocoapods installation is broken.
Make sure that when you run pod install Cocoapods runs fine.

If not, I suggest you try the following command:

sudo gem install cocoapods

or update cocoapods using:

sudo gem update cocoapods

Best,

Thanks a lot Olivier for your answer. It seems to work but I have another problem, now…
When I open my project in xCode and try to generate an archive, I get this error :
‘WonderPushExtension/WonderPushExtension.h’ file not found

… in Project>WonderPushNotificationServiceExtension>NotificationService.h

Here is the content of this file :
#import <WonderPushExtension/WonderPushExtension.h>
@interface NotificationService : WPNotificationServiceExtension
@end

Thanks for your help.

Hi Stéphane,

I suggest you remove the platform/ios/ folder and run cordova prepare ios to recreate it from scratch.
Tell me how this goes.

Best,

Hi Olivier,

I ran those commands :
cordova platform remove ios
cordova platform add ios
cordova prepare ios
ionic cordova build --release ios

Without success. I still have in NotificationService.h file in Xcode (see the screenshot attached) and I can’t build for iOs…

Thanks for your help.

Hi Olivier,

Do you have any other suggestion to fixe my problem ?

Thanks

Hey,

Exactly same problem here.
‘WonderPushExtension/WonderPushExtension.h’ file not found

I already spent hours trying to add the proper path in my Xcode settings, but I’m really unable to make it work…

How to reproduce? Nothing easier, just create a blank project with cordova, add the plugin, add the ios platform, open xcode, nothing works.

Thank for the help…

Are you, by any chance opening the .xcproject instead of the .xcworkspace in XCode?
Projects touched by Cocoapods must no longer be opened directly, you must instead open the workspace so that the companion project named Pods is available and the pods it references are available to your project.

I also recommend using a build.json file to help with configuring the development team on XCode so you do not even need to open it.


Sorry @barmz, but your reproduction does not work.

Starting with a clean installation of Node v12 on Mac OS.

# Install cordova
npm install -g cordova ios-deploy

# Create your project
cordova create appfolder com.company.app MyApp
cd appfolder

# Configure your development team so that Cordova directly generates XCode files with this setting
cat >build.json <<<EOF
{
  "ios": {
    "debug": {
      "developmentTeam": "YOURTEAMID"
    },
    "release": {
      "developmentTeam": "YOURTEAMID"
    }
  }
}
EOF

# Run on iOS
cordova platform add ios
cordova run ios

# Add WonderPush
cordova plugin add wonderpush-cordova-sdk --variable CLIENT_ID=YOUR_CLIENT_ID --variable CLIENT_SECRET=YOUR_CLIENT_SECRET --variable SENDER_ID=YOUR_SENDER_ID
# Add code to trigger the notification permission prompt as per https://docs.wonderpush.com/docs/cordova-push-notifications-quickstart#section-step-4-add-required-code
vim www/js/index.js
# Add call to: WonderPush.subscribeToNotifications();

# Test
cordova run ios
# The app prompts for notifications, the installation shows up in the dashboard
# You can also open the workspace on XCode
open platforms/ios/MyApp.xcworkspace
# Hit Run

Exactly, my bad.

First time using Cocoapods for me…

Many many thanks!