Onesignal-ios-sdk: Problem with Pod Swift 3 and Swift 4

Created on 5 Dec 2017  路  4Comments  路  Source: OneSignal/OneSignal-iOS-SDK

I am trying to install the file through pod but I am encountering an issue when I install the extension pod

pod 'OneSignal', '>= 2.5.2', '< 3.0'

The pod installed without issue but the extension getting the issue below

- Alamofire required by CepteSok (Swift 3.0), OneSignalNotificationServiceExtension (Swift 4.0)

target 'OneSignalNotificationServiceExtension' do
    pod 'OneSignal', '>= 2.5.2', '< 3.0'
end

Plase how I can solve this issue?

My code is Swift 3 and xCode is 9.1

Help Wanted

Most helpful comment

@luai-kalkatawi I had the same issue and this is what I had to do to run OneSignal in my project:

  • Add to the OneSignal Pod to to the pod file
  • Change the "Swift Compiler - Language" under "Build Settings" of the extension as @jkasten2 said on the previous answer
  • pod repo update & pod install
  • Then you'll have some conflicts with other pods and the extension. Fix one by one doing this:
    Linking to a Embedded Framework from a app extension
  • Run your project

Cheers and good luck! 馃

All 4 comments

@luai-kalkatawi The target most likely default to Swift 4 when you added it. You can lower it to Swift 3 to fix the error since the extension works with either version of Swift. This can be found by searching for "Swift Compiler - Language" under "Build Settings"

image

@luai-kalkatawi I had the same issue and this is what I had to do to run OneSignal in my project:

  • Add to the OneSignal Pod to to the pod file
  • Change the "Swift Compiler - Language" under "Build Settings" of the extension as @jkasten2 said on the previous answer
  • pod repo update & pod install
  • Then you'll have some conflicts with other pods and the extension. Fix one by one doing this:
    Linking to a Embedded Framework from a app extension
  • Run your project

Cheers and good luck! 馃

Closing due to inactivity, if you have any other questions or problems please feel free to ask!

thanks

Was this page helpful?
0 / 5 - 0 ratings