alamofire

When sending data from app to firebase-functions to PayPal, notification email is not being created

和自甴很熟 提交于 2019-12-25 03:44:47
问题 I have an app in firebase where I am trying to send the parameters to the function in firebase-functions, which sends to PayPal, but it isn't working. func payoutRequest() { print("payoutRequest") let driver_uid = self.uid! let email = txtPayoutEmail.text! let url = "https://us-central1-ryyde-sj.cloudfunctions.net/payout" let paypal_token = "mytoken" let params : Parameters = [ "uid": driver_uid, "email": email ] let headers : HTTPHeaders = [ "Content-Type": "application/json", "Accept":

Alamofire, Swift 2.0, SwiftyJSON: Parse response body as JSON

早过忘川 提交于 2019-12-25 03:35:36
问题 I have successfully completed a POST request to server and I am trying to parse the response JSON but I have been unsuccessful. Alamofire.request(.POST, ServerConfig.ADD_SELLER_URL, parameters: sellerJSON, encoding: .JSON, headers: nil) .responseJSON(completionHandler: { responseRequest, responseResponse, responseResult in print(responseRequest!.URL) print(responseResponse) print(responseResult) let json = JSON(responseResponse!) print(json) }) I am using SwiftyJSON for JSON parsing. Here is

CocoaPods not installing Alamofire in Swift Parse Chat App

你。 提交于 2019-12-25 03:34:34
问题 I am trying to compile and run the following application (Swift Chat App using Alamofire). https://github.com/huyouare/SwiftParseChat I am using ruby-2.0.0 , cocoapods 0.37.1, xcode 6.3, Alamofire 1.2.0 I am installing it using the normal <pod install> command. No errors or warnings during the process. However, when compiling, I get: No such Module 'Alamofire' If I install Alamofire manually, however, when compiling I get an Apple Match-O Linker Error : ld: warning: directory not found for

Converting ecobee Alamofire request to use URLSession

随声附和 提交于 2019-12-25 03:29:18
问题 As a followup to my last question (Alamofire syntax for ecobee request), I would prefer to just use URLSession for the request. Now I'm back to a request that times out with status 408 using the following code: guard let url = URL(string: "https://api.ecobee.com/1/thermostat") else { return } let jsonParameters = [ "selection": [ "selectionType": "registered", "selectionMatch": "" ] ] let jsonData = try! JSONEncoder().encode(jsonParameters) let jsonString = String(decoding: jsonData, as: UTF8

Deployd comparison and swift with alamofire

喜你入骨 提交于 2019-12-25 02:59:31
问题 I am trying to query data from my Deployd API with alamofire. How is it possible to do a comparison in a request. I have something like: let parameters = ["number": ["gt": 3]] Manager.sharedInstance.request(.GET, "http://localhost:2403/collections", parameters: parameters).responseJSON { (request, response, result) -> Void in print(result.isSuccess) print(result.data) } But the result is empty. In my dashboard i have a number column with the values: 1,2,3 and 4. So the response should return

Code after DispatchGroup().wait() never called

送分小仙女□ 提交于 2019-12-25 02:27:10
问题 I want to make my call to the service synchronous because I want my call to return my object already mapped with generics. Here is the code: func execute<T: Mappable>(request: HttpRequest, responseType: T.Type) throws -> T? { var responseObject: T? let group = DispatchGroup() group.enter() Alamofire.SessionManager.default.request(request.stringURL, method: request.method, parameters: request.parameter.toJSON(), encoding: request.encoding, headers: request.headers) .validate() .response

Alamofire timeout not working in Swift 3

不羁的心 提交于 2019-12-24 22:25:25
问题 I am using Alamofire for network request and want to add timeout. But Alamofire's function is not working. Nothing happens when I write the following code let manager = Alamofire.SessionManager.default manager.session.configuration.timeoutIntervalForRequest = 1 // not working, 20 secs normally (1 just for try) manager.request(url, method: method, parameters: params) .responseJSON { response in print(response) ... When I try without Alamofire for network request, timeout working successfully.

Alamofire sending a request to an API 'NSInvalidArgumentException'

*爱你&永不变心* 提交于 2019-12-24 21:33:33
问题 i am using this code to send an image and text to an api: func uploadImageAndData(_ url:String,parameters1:Parameters,headers1:HTTPHeaders,images:[UIImage]){ Alamofire.upload(multipartFormData: { multipartFormData in // import image to request var i=0 for imageData in images { // multipartFormData.append(self.resizeImage(image: uploadedProfileImage, targetSize: CGSize(width: 200, height: 200) multipartFormData.append(imageData.pngData()!, withName: "profilePic", fileName: "profileimage"+"

Encode struct and convert to dictionary [String : Any]

为君一笑 提交于 2019-12-24 20:19:41
问题 I'm a bit stuck on how I can post this json array using Alamofire. I've looked at How can I use Swift’s Codable to encode into a dictionary? and a few others but I can't seem to get it work. I'm appending a few rows from a UITableView it looks like this before encoding. [proj.DetailViewModel(Quantity: 1, RedeemedLocationID: 6, Points: 10), proj.DetailViewModel(Quantity: 2, RedeemedLocationID: 6, Points: 12)] struct DetailViewModel: Codable { var Quantity: Int! var RedeemedLocationID: Int! var

multipart/form-data using alamofire

左心房为你撑大大i 提交于 2019-12-24 19:26:27
问题 I am making an .post API call and I need to use multipart/form-data. I know how to make the call using JSON but I am not familiar with multipart/form-data. Using JSON, it is a super easy call. Just create a type parameters: var parameters:Parameters = [:] parameters["username"] = emailTextField.text! parameters["password"] = passwordTextField.text! Alamofire.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { (response) in /