How to generate Pods folder when adding onesignal-cordova-plugin in Ionic Cordova project?

1.3k Views Asked by At

I'm adding OneSignal to my Ionic Cordova project, and following this guide. In section 3.16 it mentions the Platforms -> ios -> Pods folder, but this Pods folder doesn't exist. I know that to create the Pods folder you have to run pod install, but I've never done this in an Ionic Cordova project. Should I navigate to Platforms/ios and run pod install from there? The reason I ask is that even though in section 2.1 they mention npm install ionic-cordova-plugin, they never mention running pod install.

1

There are 1 best solutions below

0
On

This whole thing seems rather iffy, as generally, in Cordova projects, the platform folder should be under .gitignore. The entire guide consists of modifying files that should not be in your repository.

That being said, in order to generate the Pods folder, cf. OneSignal's native iOS SDK guide.

  1. Create Podfile under platforms/ios
  2. Copy the contents into Podfile from the link provided (change accordingly, e.g. 'your_project_name':
target 'your_project_name' do
  #only copy below line
  pod 'OneSignal', '>= 3.0.0', '< 4.0'
end

target 'OneSignalNotificationServiceExtension' do
  #only copy below line
  pod 'OneSignal', '>= 3.0.0', '< 4.0'
end
  1. Run pod install