urlsession

How to update progressview in uitableview cell by urlsession (download/upload file)

我只是一个虾纸丫 提交于 2021-02-11 16:52:59
问题 In Objective c i wrote download/upload with progressview in uitableviewcell (multiple upload/download) by AFNETWORKING. and work find it's can be update progressview/file/cell. and Now im noob first time change to SWIFT programming and use urlsession. code class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, URLSessionDelegate, URLSessionDataDelegate, URLSessionTaskDelegate { //var dataArr:Dictionary<String,String> = [:] var dataArr : NSMutableArray =

How to update progressview in uitableview cell by urlsession (download/upload file)

自作多情 提交于 2021-02-11 16:51:30
问题 In Objective c i wrote download/upload with progressview in uitableviewcell (multiple upload/download) by AFNETWORKING. and work find it's can be update progressview/file/cell. and Now im noob first time change to SWIFT programming and use urlsession. code class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, URLSessionDelegate, URLSessionDataDelegate, URLSessionTaskDelegate { //var dataArr:Dictionary<String,String> = [:] var dataArr : NSMutableArray =

What's the proper syntax of mapping/filtering a data-stream element to convert its data type?

早过忘川 提交于 2021-02-11 14:10:59
问题 Scenario: Data stream that contains an item that has changed from an Int to String type causing the JSON parser to crash. Result: Subscriber 'sink' crashed with data type not matching the original receiving type via JSON parser. Goal: to convert the Int values to String to have a consistent stream for a successful parsing. Here's a snippet of the data stream that has caused the crash: ... { "city": "אלון שבות", "sickCount": 124, "actualSick": 15, "verifiedLast7Days": " 11-14 ", "testLast7Days

Convert CURL to URLRequest

无人久伴 提交于 2021-02-04 19:46:06
问题 I’m trying to converting the the following curl request Swagger gives me to URLRequest: curl -X GET --header 'Accept: application/json' --header 'Authorization: key ttn-account-v2.<app-key>' 'https://<app-id>.data.thethingsnetwork.org/api/v2/query' URL and Headers are set correctly. Still I get the response: 401 - Not authorized. let key = "ttn-account-v2.<app-key>" let url = URL(string: "https://<app-id>.data.thethingsnetwork.org/api/v2/query") var request = URLRequest(url: url!) request

reload map after calling urlsession data

匆匆过客 提交于 2021-01-29 15:36:16
问题 I am new in swift , I implemented a MapKit with static data , and it worked fine , and I called after that backend pins data and it showed in the playground that it works fine , but the map is not displaying the markers , it seems that the mapKit do not capture the pins data in the right time , so I used Dispatch.Que to refresh the map but I did not refresh and it is displaying without the markers here what I have tried : import UIKit import MapKit class myMapViewController: UIViewController,

Swift: How to catch disk full error on background URLSession.downloadTask?

不羁岁月 提交于 2021-01-28 13:38:16
问题 I'm struggling to understand what I thought would be easy. I have a URLSession.downloadTask. I have set my downloading object as the URLSession delegate and the following delegate methods do receive calls, so I know my delegate is set correctly. func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) func urlSession(_ session: URLSession, downloadTask: