Ios Onesignal& AlamoFireImage Podfile问题

时间:2018-03-01 18:43:10

标签: ios swift alamofire onesignal

我正在尝试将正确的依赖项安装到我的podfile中以运行我的应用程序。我需要AlamoFireImage和OneSignal pods,但由于版本问题,我无法根据需要同时下载它们。

以下是我在podfile中为他们提供的内容:

  pod 'AlamofireImage', '~> 3.3'
  pod 'OneSignal', '>= 2.6.2', '< 3.0'

以下是我运行pod install时出现的错误:

[!] The following pods are integrated into targets that do not have the same Swift version:

    - Alamofire required by Phlare (Swift 3.0), OneSignalNotificationServiceExtension (Swift 4.0)
    - AlamofireImage required by Phlare (Swift 3.0), OneSignalNotificationServiceExtension (Swift 4.0)

    [!] Automatically assigning platform `ios` with version `9.3` on target `Phlare` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

这些是教程中建议的pod文件安装说明,有没有办法解决这个问题?

1 个答案:

答案 0 :(得分:1)

您可以将pod文件定义为:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'Phlare' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'AlamofireImage', '~> 3.3'
  pod 'OneSignal', '>= 2.6.2', '< 3.0'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.2'
        end
        if target.name == 'OneSignal'
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.0'
            end
        end
    end
end