alamofire

Getting non-master branch from Cocoapods?

早过忘川 提交于 2019-12-11 12:41:25
问题 I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way? I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch. 回答1: You can

AlamofireImage cache?

你离开我真会死。 提交于 2019-12-11 12:35:18
问题 I use AlamofireImage in conjunction with PromiseKit and Alamofire . I use promises to chain the download of x number of images since I want to do this synchronically. I can't seem to understand if ImageDownloader() caches automatically or if I have to add the image explicitly to the cache? The only examples I've seen so far are not using the ImageDownloader so I have a real hard time finding an answer to this. If not - how do I add it the cache? I've tried using: self.imageDownloader

How to use swiftyjson to parse json data to foundation object and loop through data

我与影子孤独终老i 提交于 2019-12-11 12:29:28
问题 So I'm trying to get his raw json data and use it to ultimately be viewed in a table(so one table cell would be --> Emirates - $1588.77) Problem: Having trouble parsing the JSON data.. alamofire apparently does it automatically? but im completely confused with the data types. I keep getting weird errors like 'doesnt have a member named subscript" (I've also got swiftyjson installed but aa non-swiftyjson solution should work as well. Code: request(qpxRequest).responseJSON { (request, response,

RESTful mechanism to upload video (and properties) to vimeo

我的梦境 提交于 2019-12-11 11:58:19
问题 The procedure to upload a video to Vimeo starts out very similarly as the one defined for Youtube, but only up to a point. Below I describe the steps that worked , and outline the last video-upload step which does not : The Vimeo-upload dance begins when we pass the following parameters to trigger user authentication: let authPath:String = "\(url_vauth)?response_type=\(response_type)&client_id=\(client_id)&redirect_uri=\(redirect_uri)&state=\(state)&scope=upload" if let authURL:NSURL = NSURL

swift alamofire return value is empty

夙愿已清 提交于 2019-12-11 11:42:30
问题 Hi i have the following method: func getAlamoPlayers() ->[Player]{ //Get TeamID let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults() var TeamId:String = prefs.stringForKey("TEAMID")! //create parameters for POST let parameters = ["IdTeam": TeamId] var result: NSArray? //Request Alamofire.request(.POST, "XXXXXX.php", parameters: parameters) .responseJSON { (request, response, json, error) -> Void in result = (json as NSArray) // Make models from Json data for (var i = 0; i < result

Curl -d to Alamofire

倾然丶 夕夏残阳落幕 提交于 2019-12-11 10:39:28
问题 Following this page (https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html), I was able to setup OAuth for my django project. The following curl command gives me a token to access resource. curl -X POST -d "grant_type=password&username=<user_name>&password=<password>" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/ However, when I send request using Alamofire, things are a bit strange. This is my code Alamofire.request(.POST, url, parameters

Swift : What does “_, _ ” means?

泄露秘密 提交于 2019-12-11 10:19:20
问题 I was doing some research on Alamofire and I came across this block of code: switch encodingResult { case .Success(let upload, _, _): upload.responseJSON { response in if let info = response.result.value as? Dictionary<String, AnyObject> { if let links = info["links"] as? Dictionary<String, AnyObject> { if let imgLink = links["image_link"] as? String { print("LINK: \(imgLink)") } } } } case .Failure(let error): print(error) } May I know what does _, _ means? I have seen uses of it like let _

Alamofire Multiform Upload Image with Parameters

雨燕双飞 提交于 2019-12-11 09:02:30
问题 I'm using Alamofire to upload image on server, this method working fine and I have already used in many projects. I have used following code to upload image on my server using multiform data. Alamofire.upload( multipartFormData: { multipartFormData in for (key, value) in parameters { if let data = (value as! String).data(using: .utf8) { multipartFormData.append(data, withName: key) } } let imageData = image?.pngData() multipartFormData.append(imageData!, withName: "profile_image", fileName:

Decode Json Data using JsonDecoder and Alamofire

☆樱花仙子☆ 提交于 2019-12-11 08:34:37
问题 I am trying decode Json data into my Model. This is my model struct Devices : Codable { var id :String? var description :String? var status : Int? } var heroes = Devices() print(DeviceId) let loginParam: [String: Any] = [ "id": DeviceId ] let manager = Alamofire.SessionManager.default manager.session.configuration.timeoutIntervalForRequest = 5 manager.request("http://13.13.13.004/website/api/Customer/DeviceControl", method: .post , parameters: loginParam, encoding: JSONEncoding.prettyPrinted)

Incorrect argument label in call wtih AlamoFire Session Manager download

落花浮王杯 提交于 2019-12-11 08:17:01
问题 AlamoFire's documentation: let destination: DownloadRequest.DownloadFileDestination = { _, _ in let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] let fileURL = documentsURL.appendingPathComponent("pig.png") return (fileURL, [.removePreviousFile, .createIntermediateDirectories]) } My code: fileprivate let manager: Alamofire.SessionManager = { ... let destination: DownloadRequest.DownloadFileDestination = { _, _ in let documentsURL = FileManager