alamofire

Alamofire 5 Escaping Forward Slashes

橙三吉。 提交于 2019-12-02 05:39:23
Ive been googling and trying for the last few days regarding the automatic escaping of forward slashes of alamofire. (Where "/path/image.png" becomes "\/path\/image.png") However all the answers either point towards a solution if your using swiftyJson, sending via a httpBody or using the Alamofire Parameter Class. https://github.com/SwiftyJSON/SwiftyJSON/issues/440 Im not using SwiftyJson and feel to install the API just to resolve the issue is a case of hitting the nail with a sledge hammer. Anyway. My issue is whenever I'm trying to send parameters to an API, Alamofire's JSONEncoding.default

How to disable the URLCache completely with Alamofire

被刻印的时光 ゝ 提交于 2019-12-02 05:15:05
问题 Using Xcode 7.3 iOS 9.2 all in Swift none of that horrible Objective C I have been working on this for a while and been around the block three times now. I have tried this post here and it didn't work http://www.mzan.com/article/32199494-alamofire-how-remove-cache.shtml I have also try to use apple documentation but that is so crappy I cannot make sense of if. So what I am doing is making two Alamofire calls to my server. One to test the credentials of the login information to see if the

Linking error in unit test using URLRequestConvertible

孤街醉人 提交于 2019-12-02 04:33:45
问题 I have a weird problem writing a simple unit test (Xcode 7.2) for a very simple function which makes sure a parameter is added to a URL: func appendToken(token: String, toRequest request: URLRequestConvertible) throws -> URLRequestConvertible { var error: NSError? let modifiedRequest: NSMutableURLRequest (modifiedRequest, error) = Alamofire.ParameterEncoding.URL.encode(request, parameters: ["token": self.token]) guard error == nil else { // TODO: handle error throw error! } return

How to send array in params using Alamofire multipart

ε祈祈猫儿з 提交于 2019-12-02 03:30:45
I am using Alamofire for uploading image and file to the server. But I am facing issue to send an array in parameters with the image. But when I send an array in params it converts the array in JSON string. But I want to send an array in params, not JSON string. I have searched a lot and did not find any solution. So please tell me what's wrong in my code. I am using below code: let params = ["id":"112","arrayParam":["1232","12344","14325"]] let url = www.khxjjhdfsj.com/hsdgs let headers: HTTPHeaders = [ /* "Authorization": "your_access_token", in case you need authorization header */ "Content

How to compare JSON api dates with FSCalendar and display events in tableview?

限于喜欢 提交于 2019-12-02 02:59:54
问题 I have displayed events dots in calendar but not able to display same events according to month in tableview , I want to display those events like if we change the month and tableview data events should be changed , I'am confused how it can be done . I'am using FSCalendar to display events like dot and in tableview . import UIKit import Alamofire import SwiftyJSON import ToastSwift class CalendarViewController: UIViewController , UITableViewDataSource, UITableViewDelegate,

TableView.reloadData() is not working ? (SWIFT)

白昼怎懂夜的黑 提交于 2019-12-02 02:56:24
I am developing a Quiz App which fetches questions from a JSON. I have already used reloadData for TableView many times & worked as expected. But now I am fetching Questions using Alamofire & saving it in a Array & fetching the Questions from the Array. But it returns Array is Out of Index. How can i Display the First item of the Array in the first Cell ? VC class ExamController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var Exam: UITableView! var CourseID : String! var EID : String! var EName : String! var ET : String! var QArray : [String] = [] var

Alamofire custom parameters

久未见 提交于 2019-12-02 02:29:11
问题 I am trying to convert this curl call to Alamofire in Swift. curl -X POST https://content.dropboxapi.com/2/files/download --header "Authorization: Bearer ab-xxx-x-x" --header "Dropbox-API-Arg: {\"path\": "/acme101/acmeX100/acmeX100.001.png\"}" And I figured this ... let headers:HTTPHeaders = ["Authorization": "Bearer " + token2Save] let moreheaders:Parameters = ["Dropbox-API-Arg": ["path":sourcePath]] Alamofire.request("https://content.dropboxapi.com/2/files/download", parameters: moreheaders

How to disable the URLCache completely with Alamofire

六月ゝ 毕业季﹏ 提交于 2019-12-02 02:02:33
Using Xcode 7.3 iOS 9.2 all in Swift none of that horrible Objective C I have been working on this for a while and been around the block three times now. I have tried this post here and it didn't work http://www.mzan.com/article/32199494-alamofire-how-remove-cache.shtml I have also try to use apple documentation but that is so crappy I cannot make sense of if. So what I am doing is making two Alamofire calls to my server. One to test the credentials of the login information to see if the input is right. The second is to download and return the customer information for there viewing. Both are

Parsing JSON data from alamofire into Array with Dictionary

跟風遠走 提交于 2019-12-02 01:16:15
I'm trying to parse JSON data from alamorefire as follows. import UIKit import Alamofire import SwiftyJSON class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() Alamofire.request(.GET, "https://api.mynexttrainschedule.net/") .responseJSON { response in guard let object = response.result.value else { print("Oh, no!!!") return } let json = JSON(object);print(json) let schedule = json[0]["schedule"] } } } If I print json, I have a data structure like the following (stated concisely). [ { "schedule" : [ {"departureTime" : "05:09", "destination" : "Boston",

Swift - HTTP load failed (error code: -1005 [4:-4]), while uploading image through alamofire.

烂漫一生 提交于 2019-12-02 01:09:56
I am a newbie to iOS and using Alamofire to upload images. The code I have written is as follows: let image = imageView.image let imgData = UIImageJPEGRepresentation(image!, 0.2)! let headers: HTTPHeaders = [ "x-access-token": "######", "Accept": "application/json" ] let parameters = ["profile_picture": "kinza"] let url = try! URLRequest(url: URL(string:"######")!, method: .post, headers: headers) Alamofire.upload(multipartFormData: { multipartFormData in multipartFormData.append(imgData, withName: "profile_picture",fileName: "kinza.jpg", mimeType: "image/jpg") for (key, value) in parameters {