Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
2 answers
101 views

I am doing a POST request using URLSession.shared.dataTask which returns data, response and error. I would think that Error would be the same as a failed request. However, I can get the request to ...
user6631314's user avatar
  • 2,050
0 votes
1 answer
69 views

I've always wanted to do something like class URLSessionDataTask_Plus: URLSessionDataTask { var obs: NSKeyValueObservation? = nil // store the progress observer there } which would be ...
Fattie's user avatar
  • 9,770
-1 votes
1 answer
491 views

I have a .NET core WebApi endpoint with a PING method that simply returns "PONG" when called. In a SwiftUI app (XCode 15 with iOS 17.2 target) I use this code for calling it: func ping () ...
Marcello Bassiato's user avatar
0 votes
0 answers
47 views

I have iOS application which use remote API for receiving some data (transactons) by periods. API allows make one call per 10 seconds (otherwise my IP will be blocked). Because of network issues, ...
Serhii R's user avatar
0 votes
0 answers
44 views

I am building iOS app where I insert an input string and search this string using Google , then I get the data string back and use it to search for specific word or series of characters I use ...
ANDROID_IOS_BIGGENER's user avatar
-1 votes
1 answer
126 views

My app downloads a couple of files from a server, using a URLSessionDataTask. When a downloads finishes successfully (and without any errors), then it should start the next download. If there is any ...
Neph's user avatar
  • 2,013
1 vote
1 answer
684 views

I updated the Xcode to 14.3 and when I tried to run a project, I am getting this error: "Ambiguous use of 'dataTask(with:completionHandler:)'" Do you know how I can fix this issue ? ...
Louiza A's user avatar
1 vote
1 answer
805 views

when i use callback function with URLSession, i can use URLSessionDataTask to cancel a task let task = URLSession.shared.dataTask(with: URLRequest(url: URL(string: "")!)) { data, response, ...
bomo's user avatar
  • 39
0 votes
0 answers
34 views

There is a lag in loading the UIImageView called profilePic. How can I get rid of this lag? The problem seems to be in my addImage() method. private func addImage() { let donorId = ...
MartinG's user avatar
2 votes
1 answer
3k views

I am new to combine . I created an generic function which return AnyPublisher with result (T) and Error(Service error) it the custom error message . I have the pass the urlSession with ...
user avatar
-1 votes
2 answers
863 views

Trying to do an API call, and have used a data task before. Now I tried the DataPublisher instead with combine. I have developed an API that needs authorisation with a specific token. Sadly the auth ...
Spirarn's user avatar
1 vote
1 answer
969 views

I am learning about API's and decided to practice using them by writing a simple function to call an api and print the response. The issues I am having is that the response is not printing to the ...
User534t's user avatar
0 votes
1 answer
1k views

I would like to create body like in this curl example: curl --location --request POST 'https://request.url' \ --header 'Authorization: Bearer xxx' \ --form 'name="Name"' \ --form 'data="...
Libor Zapletal's user avatar
0 votes
1 answer
98 views

I have following APILoader struct in my network layer. struct APILoader<T: APIHandler> { var apiHandler: T var urlSession: URLSession init(apiHandler: T, urlSession: ...
Tharindu Ketipearachchi's user avatar
0 votes
0 answers
144 views

I am trying to make a get request to a JWT enabled API but I am getting my result in bytes instead of objects after the user logs in it is expected to go the next page where it lists user projects, at ...
Wilson Agene's user avatar
0 votes
0 answers
549 views

I am trying to make my own DynamicIP updater as a command line tool so I can set it up to run as a launch agent. I thought this would be a pretty simple thing to do, but I am not getting anything ...
SouthernYankee65's user avatar
1 vote
0 answers
161 views

I tried to handle URLSession dataTask error. When dataTask is started without internet connection , i'm getting URLError.dataNotAllowed error. When will I get URLError.notConnectedToInternet ?
iroh's user avatar
  • 623
0 votes
0 answers
898 views

I need to make 2 API calls simultaneously. I have 2 URLs for the calls, and if one of the calls will return any error I want to stop all the code execution. How I tried to do it: I have a function ...
artexhibit's user avatar
0 votes
0 answers
1k views

This is my request funtion: func receiptValidation(completion: @escaping(_ isPurchaseSchemeActive: Bool, _ error: Error?) -> ()) { let receiptFileURL = Bundle.main.appStoreReceiptURL guard ...
Tulon's user avatar
  • 4,134
1 vote
1 answer
771 views

What I am trying to do: Sometimes my URLSession call request takes a too long time to give a response back. That's why I am trying to call the call request again if it doesn't give a response back ...
Tulon's user avatar
  • 4,134
2 votes
1 answer
927 views

Didn't have any experience with datatasks and urlsessions before. So I'm curious. Case is - trying to have a table with infinite scroll. When this method called tableView(_ tableView: UITableView, ...
Alexander's user avatar
  • 446
4 votes
1 answer
999 views

After switching our API Client to Combine we start to receive reports from our users about error "The operation couldn’t be completed (NSURLErrorDomain -1.)" which is the error....
George's user avatar
  • 653
0 votes
1 answer
318 views

I am fairly knew to coding and am parsing html data from a webiste. The problem is that the elements that I can manually inspect when I view the website are very different from the source code. I ...
aadi sach's user avatar
1 vote
2 answers
552 views

I am pretty new to swift and have an app that performs a simple url data task to parse the html contents of that website. I was trying to load certain elements but wasn't getting the content that I ...
aadi sach's user avatar
0 votes
1 answer
104 views

I'm trying to implement a function in AppDelegate.m in order to update my app in background. I've found an article online (this is the link: https://medium.com/@vialyx/ios-dev-course-background-modes-...
Fabrizio L.'s user avatar
0 votes
2 answers
429 views

i am trying to fetch images data using URLSession dataTask the urls are fetched from a firebase firestore document that contains each download path using for loop in snapShotDocuments in ascending ...
Jameel Shehadeh's user avatar
0 votes
1 answer
202 views

import Foundation let headers = [     "x-rapidapi-key": "myKey",     "x-rapidapi-host": "movie-database-imdb-alternative.p.rapidapi.com" ] let urlR = URL(...
Arthur Smith's user avatar
-2 votes
1 answer
476 views

In an article, I saw a code snippet like below: extension URLSessionDataTask: Cancellable {} extension URLSession: NetworkService { public func fetchData(with request: URLRequest, handler: @...
pumpum's user avatar
  • 665
1 vote
1 answer
1k views

When I'm requesting API from my code I got response after 4-6sec which is way too long. From Postman I'm getting response after 120ms. Is that something in my code goes wrong? here is my code, I'm ...
Gorthez's user avatar
  • 421
0 votes
1 answer
188 views

I have several datataskpublisher, which performs requests to the server, from different application screens. How to make them run serial? Below will be a rough example This is a service that performs ...
Christian Moler's user avatar
8 votes
1 answer
6k views

I have the following code in my network logic: let task = urlSession.dataTask(with: request) { [weak self] (data, response, error) in if let error = error { if error....
Fred's user avatar
  • 696
1 vote
1 answer
82 views

I am trying to recover a data set from a URL (after parsing a JSON through the parseJSON function which works correctly - I'm not attaching it in the snippet below). The outcome returns nil - I ...
MRoot's user avatar
  • 45
1 vote
0 answers
401 views

I am downloading a couple of images and want to show the user some kind of progress until its finished. I found a way to track the progress of data tasks from this question get progress from ...
JPJerry5's user avatar
  • 127
0 votes
0 answers
272 views

I have an API to get about 1000 records from a GET request. Currently I'm using dataTask to get the content via URLSession. Complication is the request just freeze as soon as it enters to the ...
danu's user avatar
  • 1,199
1 vote
0 answers
81 views

Do you need to use URLSession's dataTask(with: URL) inside of an Operation class's main() method? For example: class Downloader: Operation { let postDetailsPage: PostDetailsPage init(_ ...
Eden's user avatar
  • 1,820
2 votes
2 answers
3k views

I use URLSession and URLSessionDataTask to get an image from server and display it in an app. I had a look here. It looks like URLSessionDownloadTask has more options. Currently I use the following ...
surToTheW's user avatar
  • 842
0 votes
0 answers
64 views

I have an array of video URLs that need to be downloaded. To keep the overall performance, I want to limit the concurrent download counts to 2. For example, I want to start the first two download ...
P. Tsin's user avatar
  • 605
1 vote
3 answers
532 views

I am having problems finding out why my dataTask returns an empty result. While going through My NetworkingManager class it appeared that it never enters the URLSession.shared.dataTask. Does anyone ...
Boglinger's user avatar
0 votes
1 answer
157 views

I would like to pass a parameter into my delegate to determine to continue or check for cert. - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge ...
Ezos's user avatar
  • 117
0 votes
0 answers
52 views

I have this nagging problem that I just can't seem to fix. I'm trying to call a function within a particular class (called BMUserManagementService), but for some reason the completion handler in the ...
JFortYork's user avatar
  • 149
0 votes
1 answer
248 views

I am sending a DataTask to some website and in URL I have redirection to localhost (https://...&redirect_uri=http://localhost...). Overall in that call I am getting about 5 redirections, where ...
Oschły's user avatar
  • 73
1 vote
0 answers
724 views

Hi developers im having some issue or misplaced tasks so i had to develop a framework with some functions this is my main FUNCTION where the issue began     func saveDataDevice(idPos: String, ...
ZeroCooL's user avatar
3 votes
1 answer
1k views

For some users our app is throwing NSError while trying to call a secured server API using URLSession data task. Below is the detail of the error: error-domain: NSURLErrorDomain nserror-code: -1202 ...
med's user avatar
  • 369
1 vote
0 answers
297 views

I have a ebook related app live on app store. This app downloads big files (ranging from ~100MB - 1GB) in background mode. Out of 100 users 10 users have reported problems with the download when they ...
ronghester's user avatar
0 votes
0 answers
117 views

Environment: Xcode Version 11.3 (11C29) Apple Swift version 5.1.3 Scenario: Combine Neophyte attempting to learn URLSession.shared.dataTaskPublisher Details: I made a simple app to access weather ...
Frederick C. Lee's user avatar
2 votes
1 answer
435 views

Why does dataTaskWithURL work on iOS, but not on macOS? The error message is: Client-Error: A server with the specified hostname could not be found. My routine is as follows: - (void)loadHTML { ...
Tom's user avatar
  • 668
-1 votes
1 answer
581 views

The completion handler code is not getting executed. while i debug the code its coming till the session.datatask and after that its not getting into the completion handler. we are actually migrating ...
uma's user avatar
  • 9
3 votes
4 answers
5k views

On a button click, I have to implement multiple API calls to get the data and write that data to file. I am using Operation Queue and URLSession datatask to implement this. While this API calls are in ...
Kalyan's user avatar
  • 263
1 vote
2 answers
2k views

My app downloading and saving some support data to 'Library/Caches' directory. According to documentation, Use this directory to write any app-specific support files that your app can re-create ...
frankWhite's user avatar
  • 1,532
1 vote
1 answer
2k views

I have a Xamarin project where I am able to make GET calls without headers to something like "reqres.in" API like: public Task<string> GetData() { TaskCompletionSource<string> tcs = ...
Pawan Pillai's user avatar
  • 2,085

1
2 3 4 5 6