Alamofire Xcode 8 Swift 3 results in 786 compile errors

前端 未结 10 2423
一个人的身影
一个人的身影 2020-12-29 20:00

I am using the Xcode 8.0 GM. I created a default single-view app with my deployment target set to 9.0.

In my Podfile I\'m targeting the bleeding edge Swift 3 branch:

相关标签:
10条回答
  • 2020-12-29 20:25

    The solution is to change your request from this

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3'
    

    to this

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'master'
    
    0 讨论(0)
  • 2020-12-29 20:28

    I solved similar issue by using :

    platform :ios, '9.0'
    use_frameworks!
    target 'PROJECT NAME HERE' do
    pod 'Alamofire'
    end
    
    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
    
    0 讨论(0)
  • 2020-12-29 20:31

    You should use the master branch now since the swift3 branch has been merged there. Moreover it's normal for the Xcode Migrator to show that many errors. What it's doing s compiling the code thinking it's a legacy Swift version but since it's already in Swift 3.0, the errors are to be expected. Finally, Xcode is asking you to convert to modern Swift syntax probably because you haven't used the latest version of Cocoapods to install Alamofire.

    NB: event though Cocoapods tells you to use gem install cocoapods --pre, I prefer using gem update cocoapods --pre. Else, the older version of Cocoapods stays and still is used when using pod update. Check what version you're using with pod --version.

    0 讨论(0)
  • 2020-12-29 20:35

    I had the same issue, but I uninstalled cocoapods, uninstalled alamofire, then updated my cocoa pods to 1.1.0.beta.2, then used the swift3-rebased branch of Alamofire in my pod file

    pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3-rebased'

    opened my Project.xcworkspace file and all the compiling errors for Alamofire were gone.

    0 讨论(0)
  • 2020-12-29 20:39

    Upgrading to the latest Cocoapods (at the time of this answer: version 1.1.0.beta.2) via the command:

    gem install cocoapods --pre seemed to solve the issue for my circumstance.

    0 讨论(0)
  • 2020-12-29 20:40

    Update the pod to 1.1.0.rc using the below command.

    sudo gem install cocoapods

    use the blow snippet at the end.

    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

    this helps.

    0 讨论(0)
提交回复
热议问题