alamofire

Alamofire request coming up nil

穿精又带淫゛_ 提交于 2019-12-24 15:42:49
问题 I'm developing an iOS app which user WebServices and I find Alamofire just perfect for what I'm doing but I'm having a problem; the app asks the user to login which is an Alamofire call and does it just fine. The problem is, it has to create a collection view based on the content of another Alamofire request but is always nil . func getJSON(URLToRequest: String) -> JSON { let comp:String = (prefs.valueForKey("COMPANY") as? String)! let params = ["company":comp] var json:JSON! let request =

How can I use swiftyJSON dictionaryValue as a usable string for a UILabel?

旧时模样 提交于 2019-12-24 15:23:14
问题 I have a makeRequest() method inside a UITableViewController with the following code: func makeRequest() { Alamofire.request(.GET, self.foursquareEndpointURL, parameters: [ //"VENUE_ID" : self.foursquareVenueID, "client_id" : self.foursquareClientID, "client_secret" : self.foursquareClientSecret, "v" : "20140806" ]) .responseJSON(options: nil) { (_, _, data, error) -> Void in if error != nil { println(error?.localizedDescription) } else if let data: AnyObject = data { let jObj = JSON(data) if

Alamofire Request not getting executed

强颜欢笑 提交于 2019-12-24 11:36:33
问题 Something strange is happening. I have two ViewControllers A & B. In both of them I have imported Alamofire using below command import Alamofire ISSUE: I am calling exactly the same Alamofire Request in both controller. In VC - A it executes, in VC - B --its just not executing..There is no error or anything. When I debug using breakpoints, the entire Alamofire code is getting skipped for some reason. Can't seem to figure out why. Below is my Alamofire Code (THIS IS SAME in BOTH Controllers A

Synchronous Alamofire Request with DispatchGroup

让人想犯罪 __ 提交于 2019-12-24 09:48:02
问题 I need to wait until Alamofire request finishes getting data. (Error or value). I'm calling Alamofire function inside a for loop in another function so that Alamofire requests should be finished before second for loop called. For example; first loop -> first request -> second loop -> second request...so on. Now It goes first loop -> second loop -> and after all loops finishes requests response is turning. Request Function: func like(sender_id: String, completion: @escaping (String?) -> ()){

Alamofire Post Request with nested JSON parameters

牧云@^-^@ 提交于 2019-12-24 09:42:25
问题 My Alamofire post request looks like this: Alamofire.request("http://...", method: HTTPMethod.post, parameters: parameters, encoding: JSONEncoding.default, headers: nil) .responseJSON(completionHandler: {(response) in ... }) Everything works fine if my parameters are simple: let parameters: Parameters = [ "firstName": "John", "lastName": "Doe" ] I run into problems if my parameters contain a json object. let address: JSON = [ "street": "1234 Fake St", "city": "Seattle", "state": "WA" ] let

Unable to fetch Response For Google Distance matrix in Swift

心已入冬 提交于 2019-12-24 07:27:11
问题 I am using below code to get json response for Google maps api , Unable to get json response. Making get request using Alamofire pod. Alamofire.request( "https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&key=<API_KEY>",method: .get,encoding: JSONEncoding.default) .responseString {response in print(response.request) // original URL request print(response.response) // HTTP URL response print(response.data) // server data

Alamofire 4 multipart upload with header

£可爱£侵袭症+ 提交于 2019-12-24 07:06:03
问题 How can I upload with my own headers using Alamofire v4? In case of v3, I made my own function for that like following codes, but I can't do the same thing with v4. static func upload(method: Alamofire.Method, urlString: String, multipartFormData: (data: Alamofire.MultipartFormData) -> (), completionHandler: ( response: Response<AnyObject, NSError>, statusCode:Int, json:JSON) -> ()){ Alamofire.upload(method, urlString, headers: MyRequest.makeHeaders(), multipartFormData: multipartFormData,

Library not loaded- Alamofire

青春壹個敷衍的年華 提交于 2019-12-24 03:10:59
问题 I have been plagued by a bug for hours. I am building a framework using Alamofire and am testing it in an iOS project. Whenever I run the project, I get this error: dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /Users/theodorestrauss/Library/Developer/Xcode/DerivedData/TGClient-ecnnvvvxipoufihfghkpxlfccyoc/Build/Products/Debug-iphonesimulator/TGClient.framework/TGClient Reason: image not found I have scoured the web looking at GitHub issues, Stack articles,

Alamofire Nested Requests

两盒软妹~` 提交于 2019-12-24 02:59:09
问题 I need to make three different requests to the same API. None of these calls are dependent on the other. I currently have my requests nested like so: API.getPopularMovies() { responseObject, error in if let results = responseObject { self.popularMovies = results self.API.getNowPlayingMovies() { responseObject, error in if let results = responseObject { self.nowPlayingMovies = results self.API.getUpcomingMovies() { responseObject, error in if let results = responseObject { self.upcomingMovies

Check if a file already exists before downloading it with Alamofire + suggestedDownloadDestination

一世执手 提交于 2019-12-24 01:28:18
问题 How can I check if a given file has been already downloaded before re-downloading it by using Alamofire? I'm using suggestedDownloadDestination so Alamofire will automatically choose the name of the file and save it in the choosen directory, for example the .CachesDirectory . The problem is that the value given by suggestedDownloadDestination is of type DownloadFileDestination which will return a NSURL only by calling him with the request's response , but in this way I could not ever know the