Questions tagged [nsurlsessiondatatask]

See Apple documentation for Swift (URLSessionDataTask) and Objective C.

265 questions
-1
votes
1 answer

How to execute multiple NSURLSessionDataTask serially?

In my case, when an App launches, I want to call 3 web APIs using NSURLSessionDataTask. I have 3 different methods for each API and inside each method, there is one NSURLSessionDataTask. I want to shape my code in such a way that these 3 methods…
-1
votes
3 answers

How to wait for async calls to finish

I am running three API calls using the Spotify API, in order to get the following data and store them into my Artist object: The artist. That artist's albums. Tracks of each albums of the artist. Once they are done, I would like to pass the…
Sean Calkins
  • 312
  • 2
  • 11
-1
votes
1 answer

NSURLSessionDataTask cancel and Core Data

I've got NSURLSession, that downloads new user profiles from server, then for each profile downloads array of photos, and than stores in Core Data. Every time the user reaches this screen i stop downloading tasks, clear Core Data, than fill it…
Nikita Semenov
  • 2,111
  • 4
  • 18
  • 31
-2
votes
1 answer

A question about URLSessionDataTask and Combine in Swift

In an article, I saw a code snippet like below: extension URLSessionDataTask: Cancellable {} extension URLSession: NetworkService { public func fetchData(with request: URLRequest, handler: @escaping (Data?, URLResponse?, Error?) -> Void) ->…
pumpum
  • 555
  • 3
  • 5
  • 18
-2
votes
1 answer

Why URLSession.DataTask.shared is not working properly?

I need to fetch some quizzes for my application from the server. Unfortunately, it seems that URLSession.DataTask.shared is not working. How do I fix the problem? This is for Swift 4. import Foundation import UIKit class QuizService { let…
D.J.
  • 1
-2
votes
1 answer

JSON Parsing dataTaskWithUrl returns 0 bytes of data

Hi I'm trying to retrieve data from url. So I'm using dataTask with url. THe response received is showing as 0 bytes but the I print it shown around 46171 bytes of data in upperbound...please find below screen shot. Because of this im not able to…
Ashh
  • 569
  • 1
  • 6
  • 28
-2
votes
2 answers

Could not decode JSON: The data couldn’t be read because it isn’t in the correct format

UPDATE I get the error "Error! Could not decode JSON: The data couldn’t be read because it isn’t in the correct format.". The JSON from the request is…
nullx
  • 188
  • 1
  • 11
-2
votes
1 answer

NSURLSessionDataTask in appdelegate

I would call a NSURLSessionDataTask in appDelegate when the app is open from mail, so in this function - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation I…
-2
votes
2 answers

How to delete a json object from server?

I write a code that get recipes in form of JSON from a server and present it into a UItable. NSURL *url = [NSURL URLWithString:@"http://domain.com/recipes"]; [config setHTTPAdditionalHeaders:@{@"Authorization":@" Token…
MKH
  • 153
  • 1
  • 3
  • 15
-9
votes
2 answers

Get Current Progress from URLSession.shared.dataTask

I need to get current progress (received and total bytes) of the data task for GET request to make a progress loading indicator from this data.
F. Sviatoslav
  • 55
  • 1
  • 9
1 2 3
17
18