alamofire

Swift 3 - Alamofire request - Save request to disk

和自甴很熟 提交于 2019-12-11 08:08:28
问题 I am asking this question because I didn't found any resources on this issue, and therefore I can't complete my project on this. I have this basic alamofire post request: let request = Alamofire.request("https://httpbin.org/post", method: .post, parameters: parameters, encoding: JSONEncoding.default) If I am not connected to the Internet, I want to save this request and then perform it again when the internet is connected. Any ideas on how to start on this issue? Any suggestion will be very

cellForRowAtIndexPath not called when using with Alamofire [duplicate]

蓝咒 提交于 2019-12-11 08:08:07
问题 This question already has an answer here : UITableView not updating after NSArray changed (1 answer) Closed last year . I made a function that calls list of user api and I put it in viewDidLoad so that I can get the list in TableViewCell as soon as screen get loaded. But the problem is after calling of numberOfRowsInSection , Alalmofire.rquest gets called automatically and cellForRowAtIndexPath not getting called hence TableView is empty. func userList(){ let header = [ "some header":

Update to Alamofire 4.0 and Swift 3.0 via Carthage

99封情书 提交于 2019-12-11 08:06:23
问题 I am trying to update Alamofire to version 4.0. When I run carthage update I get many errors when building Alamofire scheme. It looks like files weren't updated to Swift 3.0 syntax. What I am doing wrong? Log from terminal: *** Checking out Alamofire at "4.0.0" *** xcodebuild output can be found in /var/folders/ls/6t_b5mqx5s187hq2dtts6ys00000gn/T/carthage-xcodebuild.ORghi2.log *** Building scheme "Alamofire watchOS" in Alamofire.xcworkspace /Users/liborzapletal/Documents/Aplikace/PNG/PNG

Alamofire file upload getting error “JSON text did not start with array or object and option to allow fragments not set”

吃可爱长大的小学妹 提交于 2019-12-11 07:39:03
问题 Below is my code referring this question answer func createRequest(ResumeID: String, CandidateID: String, MediaName: String, FileExtension : String, MediaType : String) throws -> URLRequest { let parameters = NSDictionary(objects: [ResumeID, CandidateID, MediaName, FileExtension,MediaType], forKeys: ["ResumeID" as NSCopying, "CandidateID" as NSCopying, "MediaName" as NSCopying, "FileExtension" as NSCopying, "MediaType" as NSCopying]) let boundary = generateBoundaryString() let url = URL

Need your help, IOS Swift Post data to Json Alamofire

前提是你 提交于 2019-12-11 07:27:16
问题 I have a textlbabelfield in which I get data from my external database through JSon. Now, I would like to let my user to modify this field and post it to the database. But again, it doesn't work, the database did not change. Please could you review my code: PHP Code: <?php /* include db.config.php */ include_once("config.php"); // Get user id $username = isset($_POST['username']) ? mysql_real_escape_string($_POST['username']) : “”; $data = isset($_POST['signature']) ? mysql_real_escape_string

iOS/IBM Cloud/Swift: Post to Watson API using AlamoFire

核能气质少年 提交于 2019-12-11 06:47:54
问题 I am trying to post to the Watson tone analyzer API using AlamoFire with the following code. It keeps getting a 401 error which apparently means failed authorization. The same userid/password info, however, works find with a curl request. So the problem does not seem to be with the userid/password but rather with how I am forming the AlamoFire request. func postToWatson () { print("post to watson called") let url: String = "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version

Swift TRON Content Type HeaderBuilder Syntax

断了今生、忘了曾经 提交于 2019-12-11 06:14:17
问题 I'm using TRON to access an api based with ruby on rails, I sense that my problem is because the header does not have the correct information. I've been playing with the HeaderBuilder syntax from TRON but not able to really see what the syntax needs to be. My rails error is when trying to get data from a specific controller action [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.25ms) Filter chain halted as :ensure_valid_accept_media_type rendered or redirected

Alamofire extra argument 'method' in call

孤街醉人 提交于 2019-12-11 06:06:12
问题 I use Alamofire 4.0.1 and have this code: let params = Mapper().toJSON(group) Alamofire.request("\(Config().apiAdminTableGroup)\(group.id)/", method: .put, parameters: params, headers: Config().apiHeaders, encoding: JSONEncoding.default) .responseJSON { response in ... } But getting this error: Extra argument 'method' in call This is by documentation, is this bug or? 回答1: Check that the structure of your parameters and headers are right, if not the error you mentioned appears. It should look

Save Alamofire Result as Variable?

天涯浪子 提交于 2019-12-11 05:57:24
问题 I've been trying to find out how to save a part of a JSON response from Alamofire as a variable to make an if statement and can't seem to find how to do it. I made a piece of code to use as an example for the question which consists of the following: import UIKit import Alamofire class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() Alamofire.request("http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=44143256ee15e9c3f521ca062463dd8d")

How to use alamofire with object mapper in Swift3 to map an array inside an array?

谁说我不能喝 提交于 2019-12-11 05:54:15
问题 I have the following array which i am getting from Response: How to get the value of operatingDay for each id in a single string separated by commas eg: Mon,Tue,Wed.... Currently I am getting the cashPointsOperatingDays in an array as a whole. How can I write the Swift3 code? Using Object Mapper: // MARK: Travel Shops Mapper class GetTravelShopsResponse: Mappable { var message: String? var status: Int? var travelShopsData: [TravelShopsResponse]? var cashCollectionsDateTimeData: