Alamofire and Reachability.swift not working on xCode8-beta5

末鹿安然 提交于 2019-12-12 19:03:22

问题


I have a custom CocoaPod created in swift2.3 and it has Alamofire and Reachability libraries inside the project. I mean I did integrate Alamofire and Reachability into the project manually.

It still works perfectly on xCode7.3.1 and I am going to update it to swift3 on xCode8-Beta5. I tried to update it but I couldn't get it done successfully.

Here is how I did for the update.

  • Replaced Alamofire and Reachability in the project folder for swift3 from https://github.com/Alamofire/Alamofire/tree/swift3
  • Opened xCode8-Beta5 and converted all files to Swift3 syntax(actually xCode asks it when opening the old version project). So the converting was done automatically by xCode.
  • And I tried to build the Cocoapod but it gives a the bunch of error.

How can I solve this problem and update the Cocoapod successfully?

I tried to update two Cocoapods on xCode8-beta6 but Alamofire is still not working. Here is a screenshot.

https://www.dropbox.com/s/gm8ud67qc1ixffb/Screen%20Shot%202016-08-20%20at%2011.06.31%20AM.png?dl=0


回答1:


If you plan to convert your code into swift 3, and to develop in the latest XCode 8 Beta 6 (forget to use Beta 5, I was trying to success round a clock and finally in Beta 6 it is possible to use Alamofire without rewriting all their code):

You need to update the Alamofire to its 4.0 version. I was waiting for this version neverending weeks between beta 2 and beta 6, as it wasn't able to use Alamofire at all. Apple ischanging SDK version by version during summer, but now the latest branch of this framework is on github. In your Podfile you need to set more parameters to be able to use update stuff in these beta times. They are hardworking on swift3 branch.

If you don't use 4.0 version, there are many issues that XCode is not able to resolve in its convertor for its previous versions of Alamofire. Huge amount of code they had to change.

They announced they will produce official 4.0 version after Apple releases GM seed. So until we get XCode GM Seed, put this to your Podfile before its install:




回答2:


I could build Alamofire and Reachability frameworks successfully on xCode8-beta6 without any problem from the following branches.

https://github.com/Alamofire/Alamofire/tree/swift3 https://github.com/ashleymills/Reachability.swift/tree/feature/ios10



来源:https://stackoverflow.com/questions/39047431/alamofire-and-reachability-swift-not-working-on-xcode8-beta5

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