alamofire

How to perform sequential request with Alamofire and update a progressHUD at every step in Swift 3

假如想象 提交于 2019-12-12 04:12:16
问题 Ok, I am going nuts over this one... I'm using Alamofire 4.x (Swift 3 and XCode 8.1). I need to fetch and parse several html requests from a site that requires authentication (no json API, unfortunately). The HTML is then parsed with Fuzi and this progress can take some time so I plan to use a ProgressHUD (PKHUD to be exact) to let users know about what is going on. I also need to grab some html that is not behind an authentication. I created a struct and functions to handle the overall

Alamofire Swift 3 - Extra Argument in Call Error

佐手、 提交于 2019-12-12 03:48:28
问题 Xcode forced me to update some old swift 2.3 syntax to 3.0. Alamofire is 4.0.1. When trying to build a project it fails with error for extra argument in call. Alamofire.request(url, .GET, parameters: ["part":"snippet,contentDetails", "key": API_KEY,"maxResults":50, "channelId":channelId], encoding: ParameterEncoding.URL, headers: nil).responseJSON { (response) in How do i fix this issue. It shows up in over 6 files in project. Almost identical error. 回答1: Do the call like below Alamofire

Alamofire Invalidate credential

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:44:44
问题 I'm using Alamofire to do a simple request Alamofire.request(.GET, URL) .authenticate(user: user, password: password) .responseJSON { response in ... } After a first valid request, I changed the credential with invalid ones and the request succeed, but it should fail. How can I invalidate previous credentials? After a successful request, if I change the credential, Alamofire authenticates the previous credential. How can I invalidate previous credentials? 回答1: I experienced exactly the same

Swift setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key

喜欢而已 提交于 2019-12-12 03:25:11
问题 I removed manually from my Xcode project Alamofire POD and since this time, I have errors in some UIViewControllers on any UIButton IBOutlet added. I have the following error: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btListOrdo I tried to create a new UIViewController and link it to my StoryBoard but I have the same error.... I'm adding the following IBOutlet @IBOutlet

how to upload a picture or a wav file with some parameters using Alamofire.upload function

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:14:39
问题 I want to upload some file to a server, but it needs a token to post with the file together. I got the token when I logged in, so how could I post to the server? Can I write code like this? var par=[ "token":"xxxxxxxxxx", "file":"filename.file" ] Alamofire.upload(.POST, "http://www.xxxxx.xxx", parameters: par) 回答1: This is most likely not supported in the current version of Alamofire depending on your server implementation. Multipart Form Data Your server most likely expects the data to be

How do I get Alamofire to Encode this Url - it keeps dropping parameter

混江龙づ霸主 提交于 2019-12-12 03:09:29
问题 I am trying to get Alamofire to encode this url as below using URLEncoded https://domain.com/rest/api/2/search?query=assignment=user123()%20order%20by%20lastUp%20desc I have used the following code: let endpoint = "https://domain.com/rest/api/2/search/" let params:[String:AnyObject] = ["query" : "","assignment" : "user123() order by lastUpdated desc"] but when Alamofire encodes the url it drops the "query" parameter altogether and gives me this: https://domain.com/rest/api/2/search?assignment

AlamoFire + SwiftyJSON on iOS 9.0

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 02:38:52
问题 I have been trying to install and use AlamoFire and SwiftyJSON on iOS 9 using CocoaPods. The latest version keeps getting installed and it is not compatible with iOS 9.0. My PodFile looks like this: platform :ios, '9.0' use_frameworks! target 'Kitchology' do pod 'Alamofire' pod 'SwiftyJSON' pod 'AlamofireImage' end I tried commenting them out and doing a pod install to remove them, then put them back in and do another pod install. Every time the latest is installed. I do have the project

How to identify specific values in JSON response

删除回忆录丶 提交于 2019-12-12 02:36:25
问题 I would like to obtain specific JSON response. For example, obtaining only the results (i.e. name and score) in the array with id 25 and 26. Is there like a WHERE clause in swift? I'm using Alamofire and SwiftyJSON if that helps. Right now my code just pulls in all the values but I want to only have the results with id 25 and 26. Is that possible? My code: Alamofire.request(.GET, endPoint).validate() .responseJSON { response in switch response.result { case .Success: if let value = response

array of objects set to be parameter when using POST request of Alamofire

拟墨画扇 提交于 2019-12-12 02:27:46
问题 I am using Alamofire to POST a request to the server, the body of the request contains one parameter that in the form of : list: [ { "phone":"13917115283", "name": "Sky" }, { "phone":"13689652145", "name": "RJ" } ] Any idea how to post such a request? Thanks 回答1: You can easily achieve this easily by using SwiftyJSON Install it via Cocoapods or manually. For manually you can simply download and add the SwiftyJSON.xcodeproj file in your workspace. Add SwiftyJSON framework for iOS in Build

Possible error in the installation of the library Alamofire

拟墨画扇 提交于 2019-12-12 02:06:53
问题 I'm new, so sorry for the question. I have already used the previous post "Alamofire framework not found" to find the solution but I wanted to know if it was my mistake in the installation or depended on something else. When I create the project, initialize the project with git init, I add the repository via the terminal Alamofìre (I use the guide on github), when Alamofire.xcodeproj drag the file into your app project navigator of the result 1 time out of 20 is that the library is always