alamofire

Alamofire framework not found(Xcode-8.2.1 and iOS 10.2)

匿名 (未验证) 提交于 2019-12-03 02:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have tried so many solutions out there but finally not getting what to do . I just installed cocoa pods for Alamofire and swiftyJson . And now when i clean and build my project i get an error NO SUCH FRAMEWORK ALAMOFIRE when I try import Alamofire in any swift file it says: NO SUCH MODULE ALAMOFIRE My Updated Podfile is something like this( No such framework Alamofire error is solved by this pod file). But still getting No such Module alamofire -: # Uncomment the next line to define a global platform for your project platform :ios, ’10.2’

POST requests in Alamofire Parameter Encoding returning GET responses

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to make a Route Builder in swift using Alamofire (3.0) and I have succeded for all my GET requests, but when I try to make a POST request, for example, I still get the same responses of the GET method. My API Routes are: /users / / GET -> return list of users / users //POST -> create new user with the parameters sent When I use Postman everything works fine. Here is my Router code: import Foundation import Alamofire enum UserRouter : URLRequestConvertible { static let baseURL = NSURL ( string : "http://192.168.0.106

Alamofire 5 Escaping Forward Slashes

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Ive been googling and trying for the last few days regarding the automatic escaping of forward slashes of alamofire. (Where "/path/image.png" becomes "\/path\/image.png") However all the answers either point towards a solution if your using swiftyJson, sending via a httpBody or using the Alamofire Parameter Class. https://github.com/SwiftyJSON/SwiftyJSON/issues/440 Im not using SwiftyJson and feel to install the API just to resolve the issue is a case of hitting the nail with a sledge hammer. Anyway. My issue is whenever I'm trying to send

Alamofire Swift 3.0 Extra argument in call

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have migrated my project to Swift 3 (and updated Alamofire to latest Swift 3 version with pod 'Alamofire', '~> 4.0' in the Podfile). I now get an "Extra argument in call" error on every Alamofire.request. Eg: let patientIdUrl = baseUrl + nextPatientIdUrl Alamofire.request(.POST, patientIdUrl, parameters: nil, headers: nil, encoding: .JSON) Can anybody tell me why ? 回答1: According to Alamofire documentation for version 4.0.0 URL request with HTTP method would be followings: Alamofire.request("https://httpbin.org/get") // method defaults to

Swift : The data couldn’t be read because it isn’t in the correct format

匿名 (未验证) 提交于 2019-12-03 01:46:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to call the POST Api with Alamofire but it's showing me an error of incorrect format. This is my JSON response: [ { "_source": { "nome": "LOTERIAS BELEM", "endereco": "R DO COMERCIO, 279", "uf": "AL", "cidade": "BELEM", "bairro": "CENTRO" }, "_id": "010177175" }, { "_source": { "nome": "Bel Loterias" }, "_id": "80224903" }, { "_source": { "nome": "BELLEZA LOTERIAS", "endereco": "R RIVADAVIA CORREA, 498", "uf": "RS", "cidade": "SANTANA DO LIVRAMENTO", "bairro": "CENTRO" }, "_id": "180124986" } ] class Album: Codable { var _source : [

Alamofire - not be code signed because its settings don't specify a development team in Xcode 8

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I hit the error on below on Xcode 8, can everyone help to solve it. My application need to support iOS 8 and above. Alamofire will not be code signed because its settings don't specify a development team. “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly. Thanks 回答1: What did it for me with the updated Alamofire and

Alamofire: [Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-999 “cancelled”

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The service I'm connecting to is using a self signed certificate. For dev purposes I do not want to validate that chain. Using swift 3 with Alamofire 4. Fixed the ATS accordingly: <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>url.com</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSExceptionRequiresForwardSecrecy</key> <false/> <key>NSIncludesSubdomains</key> <true/> </dict> </dict> </dict> Code to connect and disable evaluation. let serverTrustPolicies: [String: ServerTrustPolicy

Sending json array via Alamofire

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wonder if it's possible to directly send an array (not wrapped in a dictionary) in a POST request. Apparently the parameters parameter should get a map of: [String: AnyObject]? But I want to be able to send the following example json: [ "06786984572365", "06644857247565", "06649998782227" ] 回答1: You can just encode the JSON with NSJSONSerialization and then build the NSURLRequest yourself. For example, in Swift 3: var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField:

Alamofire Type &#039;ParameterEncoding&#039; has no member &#039;URL&#039; Swift 3

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to migrate my codes from swift 2 version to swift 3 version. I could not migrate following code part and I did not find any solution for it. How can I do it? // MARK: URLRequestConvertible public var URLRequest: NSMutableURLRequest { let urlComponent = NSURLComponents(string: Router.baseURL)! urlComponent.path = Router.basePath.stringByAppendingString(path) let mutableURLRequest = NSMutableURLRequest(URL: urlComponent.URL!) mutableURLRequest.HTTPMethod = method.rawValue var parameters: [String: AnyObject] = Dictionary()

How to parse JSON response from Alamofire API in Swift?

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Following code I have written and I am getting response in JSON also but the type of JSON is "AnyObject" and I am not able to convert that into Array so that I can use that. Alamofire.request(.POST, "MY URL", parameters:parameters, encoding: .JSON) .responseJSON { (request, response, JSON, error) in println(JSON?) } 回答1: The answer for Swift 2.0 Alamofire 3.0 should actually look more like this: Alamofire.request(.POST, url, parameters: parameters, encoding:.JSON).responseJSON { response in switch response.result { case .Success(let JSON):