我在我的应用程序中使用Xcode 8和swift 3.0,必须在iOS 8.0和+中运行。虽然Alamofire 4.0不支持iOS 8.0,但是还有其他库像Alamofire一样管理网络,但支持Xcode 8.0,swift 3.0和iOS 8.0作为最小部署目标?等效的Alamofire库,支持swift 3.0和iOS 8.0+
回答
对于大多数要求URLSession
是很够了,我看没有更多的理由来使用任何库在iOS的网络了。
我们有一个项目从Alamofire开始,并且移植到Swift 3,所以它仍然使用相同的请求生成过程。致Alamofire然后被替换使用:
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration, delegate: nil, delegateQueue: OperationQueue.main)
let task = session.dataTask(with: request.urlRequest) { data, response, error in
// Process response
}
task.resume()
Alamofire 4.0使用流委托,它是iOS中,因为9.0,所以你不能使用SWIFT 3.0和4.0 alofire为iOS 8.0,唯一的方法是:
如果你想使用Xcode中8 Alamofire,而针对iOS 8,请使用Alamofire 3.5.0和Swift 2.3。 (官方的回答)
https://github.com/tonyli508/AlamofireDomain(自定义alamofire做你想要什么)
你能告诉我什么我要放在pod文件? (pod'AlamofireDomain','〜> 4.0'?) –
所以你应该把这样的东西: pod'AlamofireDomain',::git =>“https://github.com/tonyli508/AlamofireDomain” –
- 1. Xcode 8.0 swift 3.0错误Alamofire-swift.h未找到,无法构建Objective-C模块'Alamofire'
- 2. iOS 3.0的UIModalTransitionStylePartialCurl支持?
- 3. 发布IOS问题(无效Swift支持)
- 4. BPM 8.0支持TLS1.2?
- 5. 是eventKit支持IOS 3.0
- 6. Swift 3.0和Alamofire发布数组
- 7. 如何支持iOS 3.0而不支持iOS 3.2
- 8. Firebase推送通知 - XCode 8.0/Swift 3.0/ios 10.0
- 9. xamarin registerForRemoteNotificationTypes:在iOS 8.0和更高版本中不受支持
- 10. Subsonic 3.0和DB2支持?
- 11. spring 3.0和JSRI68支持
- 12. 声明枚举路由器Alamofire swift 3.0
- 13. Swift 2.0 + Alamofire 3.0 - 缓慢加载JSON
- 14. iOS didUpdateLocations抛出错误iOS 8.0 Swift
- 15. Swift 3的领域支持
- 16. iOS webRTC库支持armv7和arm64
- 17. iOS 8.0中的OneSignal集成Swift
- 18. Xcode 8.0 Swift 3.0缓慢索引和建设
- 19. Swift不支持SDK'iPhoneSimulator8.4.sdk'
- 20. Swift不支持SDK'iPhoneSimulator9.3.sdk'?
- 21. 通过Carthage更新到Alamofire 4.0和Swift 3.0
- 22. Alamofire 3.0请求
- 23. Swift 3中的Alamofire与iOS 8
- 24. NetBeans中的Grails 3.0支持
- 25. Actionscript 3.0中的fscommand2支持?
- 26. SwiftSoup支持Swift 4
- 27. SWIFT 3.0.1支持SwiftyJSON框架
- 28. 无效的Swift支持xcode 8 itunesconnect问题
- 29. PayMill SDK iOS Swift 3.0 Xcode 8.1
- 30. Slack登录无效。 Swift 3.0
一切都在要求,没有别的事要做。应该已经为Alamofire创建了请求生成,因此您可以重复使用它。否则,request.httpMethod =“POST”将是设置方法的最原始方式。 –