alamofire

Delay in making http requests using Alamofire in playground

不问归期 提交于 2019-12-13 04:47:55
问题 I am running into a strange issue where Alamofire.request(.GET) statement in my playground gets executed after some delay in the playground Setup: I followed the following link to import Alamofire framework to test networking requests in xcode playground. This is the code I have in my playground. And when I look at the logs of my webserver the logs get updated after almost ~few minutes delay. I have verfied that it is not the log process that is causing delay. Making same http request using

'value' is inaccessible due to 'internal' protection level

瘦欲@ 提交于 2019-12-13 03:38:38
问题 Setting up API for openweathermap. However, when it comes to setting up this: func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let location = locations[0] lat = location.coordinate.latitude lon = location.coordinate.longitude AF.request("http://api.openweathermaps.org/data/2.5/weather?lat=\(lat)&lon=\(lon)&appid=\(apiKey)&units=metric").responseJSON { response in self.activityIndicator.stopAnimating() if let responseStr = response.result.value {

How Can I make & send array of dictionary (JSON Format ) send to server using Alamofire in swift 3

心不动则不痛 提交于 2019-12-13 03:35:25
问题 I have tried to create & send array of dictionary JSON format to Alamofire. { "attendance": [{ "attndid":"0", "psngrtype": "student", "date":currentdate, "cuid": "25", "enttid": "21", }] } Here, I am used tableview, In the above "cuid" & "enttid" I giving value from selectable tableview cell data. remaining are constant. I am passing one array of dictionary, if i select one tableview cell data. and two array, if i select two cells.etc.. and I am using below code and I get but getting issue

How to get values of an array of dictionary from alamofire response using swift3

淺唱寂寞╮ 提交于 2019-12-13 03:32:08
问题 I'm trying to extract "translations" Array "text" and "verses" array "verse_key" data from below json response using Alamofire and swift3. { "verses": [ { "id": 1, "verse_number": 1, "chapter_id": 1, "verse_key": "1:1", "text_madani": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ", "text_indopak": "بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ", "text_simple": "بسم الله الرحمن الرحيم", "juz_number": 1, "hizb_number": 1, "rub_number": 1, "sajdah": null, "sajdah_number": null, "page_number": 1, "audio": {

Camera and gallery image upload by alamofire in swift 3

那年仲夏 提交于 2019-12-13 03:20:59
问题 Hi there i have spent more than 20 hours to figure out how to upload image from my app to server, image which i want to upload could be either taken from camera or photo roll..... here is my code which does show progress of uploading but doesnt reach to server and thus gets negative response form server.. please help me.. Alamofire.upload(multipartFormData: { multipartFormData in multipartFormData.append(UIImageJPEGRepresentation(image, 0.1)!, withName: imageName) for (key, value) in

how to store the response of a service in a model with alamofire

主宰稳场 提交于 2019-12-13 03:04:28
问题 I am learning to programme in swift, I developed with android previously the consumption of services and stored them in a model with the help of retrofit and serializable. Now in swift, I use the Alamofire 4.0 and SwiftyJson to consume a service and the problem is how to save all the response JSON in a model and then use this data, I have reviewed several examples but I still do not understand how to do it. Could you tell me how to do it or what I need to add to complete this action to get

How do I use JSON element with alamofire

…衆ロ難τιáo~ 提交于 2019-12-13 02:58:08
问题 I am using two textfields to pass login information to the PHP web service using Alamofire in the following way. @IBAction func LoginButton(_ sender: Any) { //getting the username and password let parameters: Parameters=[ "Name":TextFieldUserName.text!, "Pass":TextFieldPassword.text! ] Alamofire.request(URL_USER_LOGIN, method: .post, parameters: parameters).responseJSON { response in //printing response print(response) The following Json data is received on login. [{"code":0,"message":"Check

error: EXC_BAD_ACCESS (code=1, address=0x6f697483). The process has been returned to the state before expression evaluation

a 夏天 提交于 2019-12-12 23:45:26
问题 After getting API success response, I am saving, updating and fetching the data from core data DB. import Foundation import SwiftyJSON protocol WKQuizInformationVMDelegate { func success(details: QuizDetails?, isSuccess: Bool, quizID: String) func detailsFailure(error: String, quizID: String) } class WKQuizInformation: NSObject { var quizDetails: QuizDetails? var delegate: WKQuizInformationVMDelegate? //Retrieve Particular Quiz Information from server func retrieveParticularQuizInfo(quizID :

Alamofire and Reachability.swift not working on xCode8-beta5

末鹿安然 提交于 2019-12-12 19:03:22
问题 I have a custom CocoaPod created in swift2.3 and it has Alamofire and Reachability libraries inside the project. I mean I did integrate Alamofire and Reachability into the project manually. It still works perfectly on xCode7.3.1 and I am going to update it to swift3 on xCode8-Beta5. I tried to update it but I couldn't get it done successfully. Here is how I did for the update. Replaced Alamofire and Reachability in the project folder for swift3 from https://github.com/Alamofire/Alamofire/tree

HTTP status 415 when using Alamofire multipart upload

我的未来我决定 提交于 2019-12-12 16:29:54
问题 I'm trying to get an image uploaded to a RESTful web api and I'm getting a HTTP status 415 (unsupported media type). The strange thing is I did have it working the other day and i'm not to sure what i've changed to make it stop accepting the POST request. My swift code: func uploadImage(image: UIImage, userId: String, completion: () -> Void) { parameters["userId"] = userId let imageData = UIImageJPEGRepresentation(image, 70) let urlRequest = urlRequestWithComponents(myUrl, parameters: