Linker Error After Updating swift Version and pods

久未见 提交于 2019-12-12 15:18:29

问题


I am installing Alamofire with pods and getting compile time error. There are a lot of questions regarding this but:

Deleting the derived data & updating pods won't work for me.

This is the error:

Alamofire/Alamofire.framework/Alamofire compiled with newer version of Swift language (3.0) than previous files (2.0) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)


回答1:


Update following things in your pod files:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '2.3' || '3.0'
            config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
        end
    end
end



回答2:


Add this at the end of your pod file and run pod install:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end



回答3:


first remove your pods then clean derived data then -You can replace this on .podfile.

platform :ios, '9.3'
source 'https://github.com/CocoaPods/Specs.git'

target 'Meanwise' do
  use_frameworks!
  pod 'pop', '~> 1.0'
  pod 'Alamofire', '~> 4.0'

end



回答4:


To fix particular swift pod version:

Code snippet:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == '<insert target name of your pod here>'
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end
end


来源:https://stackoverflow.com/questions/40859316/linker-error-after-updating-swift-version-and-pods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!