alamofire

How to post parameter with (+ plus sign) in Alamofire

北慕城南 提交于 2019-12-23 03:29:13
问题 when post A+ or O+ or any (+) bloods types with + character, I receive a "not valid blood" error. The blood value is in JSON dictionary: How do I post + character in Alamofire? let dictionary = ["fname": "name", "lname": "family", "blood": "A+"] let updateData = try! JSONEncoder().encode(dictionary) let jsonString = String(data: updateData, encoding: .utf8)! var components = URLComponents(string: registerUrl)! components.queryItems = [ URLQueryItem(name: "api_key", value: apiKey),

Alamofire 3.0 - EXC_BAD_ACCESS on iOS 9.1

笑着哭i 提交于 2019-12-23 02:41:22
问题 Doubtful that this is a widespread issue, but hoping someone could help if they've had a similar problem. I'm having this weird issue that only appears when running my App on the device, Alamofire works fine in the simulator. This started to appear after I upgraded to iOS 9.1 on my device. Now when I test the app on my device, as soon as I make my first Alamofire request, an EXC_BAD_ACCESS appears on the var components line under the defaultHTTPHeaders > acceptLanguage block (see Image) The

iOS: “no such module” with Alamofire

萝らか妹 提交于 2019-12-23 02:18:11
问题 I have this error when I try to archive my app (adHoc or distribution) "NO SUCH MODULE" I followed all the instructions in the official page https://github.com/Alamofire/Alamofire#manually (manually installation) But when I RUN my app it works fine, and when I try to ARCHIVE it to get ipa for distribution or adHoc version, I get the error in the image above. What happen? p.s. I use xCode 7.0.1 with swift 2.0 Thanks 回答1: This is a strange issue being seen with Xcode 7.0.1, Swift 2.0. Even I am

iOS: “no such module” with Alamofire

廉价感情. 提交于 2019-12-23 02:18:08
问题 I have this error when I try to archive my app (adHoc or distribution) "NO SUCH MODULE" I followed all the instructions in the official page https://github.com/Alamofire/Alamofire#manually (manually installation) But when I RUN my app it works fine, and when I try to ARCHIVE it to get ipa for distribution or adHoc version, I get the error in the image above. What happen? p.s. I use xCode 7.0.1 with swift 2.0 Thanks 回答1: This is a strange issue being seen with Xcode 7.0.1, Swift 2.0. Even I am

How to put image into AutoPurgingImageCache after af_setImageWithURL completed?

筅森魡賤 提交于 2019-12-23 02:01:31
问题 I want to use imageView.af_setImageWithURL(URL) together with the AutoPurgingImageCache from AlamofireImage. How can I be informed that af_setImageWithURL fetched the image, so I can put it into my cache? Because this is done in Background. I'd prefer something like: imageView.af_imageFromCache(URL) which sets the image from cache if it is already in there or otherwise downloads async, then sets the image and saves it in the cache. 回答1: The shared ImageDownloader that the UIImageView uses

iOS Alamofire Incorrect Authorization Header

随声附和 提交于 2019-12-23 01:57:21
问题 I'm having this issue where Alamofire is using an incorrect authorization header when sending a request to my server. The first time I use the username and password and everything works fine. Then if I change the username and password quickly and retry the request as a different user it completely fails. When I print the HTTP headers in the iOS console it is correct every time. But when my server prints the headers it's different then the headers I printed on the iOS console. If I wait a

Disable Cache Alamofire iOS

不打扰是莪最后的温柔 提交于 2019-12-22 23:40:15
问题 I'm trying to disable caching when making iOS requests using Alamofire. When I try to make a request to the server and then make a request while authenticated as a different user I get a 304 status code back. I've tried everything at this link, all of which don't work or result in errors. The backend is using Express.js to handle requests and Passport.js for user auth. Is the correct approach to disable caching on Alamofire and on the iOS application? Or is there something I can do to prevent

Alamofire and SwiftyJSON for Swift 2.0

北战南征 提交于 2019-12-22 13:58:53
问题 I am updating my code for Swift 2.0 for today, however the line var json = JSON(json) gives me the following error Cannot invoke intializer for type 'JSON' with an argument list of type (Result) Do you guys have any idea how should I change my code? @IBAction func changePassword(sender: UIBarButtonItem) { Alamofire.request(.POST, AppDelegate.kbaseUrl + "users/me/password", parameters: ["old_password": self.oldPasswordTextField.text!, "new_password": self.newPasswordTextField.text!, "confirm

Alamofire and SwiftyJSON for Swift 2.0

可紊 提交于 2019-12-22 13:58:12
问题 I am updating my code for Swift 2.0 for today, however the line var json = JSON(json) gives me the following error Cannot invoke intializer for type 'JSON' with an argument list of type (Result) Do you guys have any idea how should I change my code? @IBAction func changePassword(sender: UIBarButtonItem) { Alamofire.request(.POST, AppDelegate.kbaseUrl + "users/me/password", parameters: ["old_password": self.oldPasswordTextField.text!, "new_password": self.newPasswordTextField.text!, "confirm

What is the use of the validate() method in Alamofire.request? [closed]

久未见 提交于 2019-12-22 10:39:51
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Alamofire.request(.GET, getUrl("mystuff")).validate() - what is the use of the validate() method? How can I use it to validate server connection issues? 回答1: As the documentation on GitHub mentions, validate() without parameters checks if the status code is 2xx and whether the optionally provided