Questions tagged [nsurlsession]

NSURLSession is the API for HTTP connections introduced in iOS 7 and OS X 10.9.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

NSURLSessionWebSocketDelegate delegates not being called iOS Objective c

I'm facing an issue with NSURLSessionWebSocketDelegate in my iOS application. I've set up the websocket connection using NSURLSessionWebSocket and implemented the necessary delegate methods, but it ...
mohamed mansoor's user avatar
0 votes
0 answers
15 views

How to synchronously call multiple API's using NSURLSession and wait till the JSON response has been downloaded in xamarin forms

How to download data by making multiple API calls in a synchronous manner and wait till all the API's have been executed and data has been downloaded.. using NSURLSession in Xamarin Forms. The Issue i ...
MainakChoudhury's user avatar
2 votes
0 answers
47 views

Where to set com.apple.application-identifier entitlement for background URLSession?

I am receiving a warning in my macOS app during compilation: Background URLSession adopters are required to have the com.apple.application-identifier entitlement. J. I am utilizing NSURLSession, but I ...
Jared's user avatar
  • 150
0 votes
1 answer
41 views

Is it possible to change defaultSessionConfiguration of NSURLSessionConfiguration?

I have an ios app. I want to modify defaultSessionConfiguration so that every time later in the code when I call [NSURLSessionConfiguration defaultSessionConfiguration] I will get my modified ...
Shmulinson's user avatar
0 votes
0 answers
43 views

`canInitWithRequest` not called in Xcode 15

We're currently using PINRemoteImage as an image loader and also OHHTTPStubs to mock network requests for testing. All of this was working perfectly fine in Xcode 14, but image stubbing fails to work ...
Mr.P's user avatar
  • 1,406
0 votes
1 answer
30 views

How to use URLSession to decide ignoreSSL from another class?

Here I have RCTHTTPRequestHandler+ignoreSSL.m that can ignoreSSL based on value from plist.info. It works nicely when I set the value of ignoreSSL from plist.info. #import "React/RCTBridgeModule....
Ivan Surya Hutomo's user avatar
0 votes
0 answers
31 views

Objective C POST call not executing NSURLSession

I would like to call a POST url and pass JSON data. For some reason my NSURLSessionDataTask is not firing at all I believe. I do not see any issues with my JSON data and api url is working fine (...
Vic85's user avatar
  • 73
0 votes
0 answers
44 views

Swift URLSession returns incorrect amount of bytes on request

I have a url session requesting data by URL. The issue is the data retrieved by the url on a fresh app open is not proper. Problem: For example I delete the app and re-download the app and make a ...
adalovelacy's user avatar
0 votes
0 answers
46 views

URLSession.didReceiveChallenge : how to ignore one specific certificate check on server-side authentication

I'm using macOS native framework to sent https requests (nsurlsession). In order to handle TLS flows of server-side authentication, I've implemented the didReceiveChallenge callback. In my special ...
Zohar81's user avatar
  • 4,752
0 votes
1 answer
393 views

Swift - How to make sure app is continue fetching data in background?

I have an iOS application where the user can trigger a lengthy update process by tapping on a button. The update process involves making API calls that can take a few minutes to complete. Everything ...
Mahdi's user avatar
  • 31
0 votes
0 answers
179 views

How to send image to server in post request?

Well, i need to send path of photo file, but i always have Fatal error: Unexpectedly found nil while unwrapping an Optional value. Here what a post request looks like: let parameters = [ [ "...
Alexander Chebotarev's user avatar
0 votes
0 answers
102 views

How to correctly make post request

I need to make post request with my data. Also it takes access_token in header. Now I will describe the complete structure of my post-request in body. I have to send description which takes String. ...
Alexander Chebotarev's user avatar
0 votes
0 answers
57 views

NSURLSessionWebSocketTask return Bad Address error

We receive bad address error Error:(kNWErrorDomainPOSIX 错误 14 - Bad address),未能完成该操作。 Translated:(kNWErrorDomainPOSIX error 14 - Bad address),The Operation Can't Be Completed. Environment: iPhone 8#...
Kam's user avatar
  • 51
0 votes
1 answer
315 views

iOS URLSession delegate method (session, dataTask, willCacheResponse, proposedResponse) not called

I need the API responses to be cached for a longer duration. Hence, I am trying to modify the 'max-age' header for the API response. But the urlSession(_ session: URLSession, dataTask: ...
7vikram7's user avatar
  • 2,794
0 votes
1 answer
82 views

URLSession mysteriously fails on cell network only

Call made like this let jsonData = try JSONSerialization.data(withJSONObject: requestBody) var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("application/...
erotsppa's user avatar
  • 14.5k
-1 votes
1 answer
56 views

Alamofire DidFinishCollectingMetrics Crash

I have an application that consists of listing page and detail page. Pressing the back button on the navigation repeatedly before the detail request is completed. Alamofire is also experiencing this ...
Özgü Ataseven's user avatar
0 votes
0 answers
66 views

POST NSData to a Server

I am trying to POST the iPhone depth data to a Macbook using wifi (at-least 30 fps). I extracted depth CVPixelBuffer from ARSession followed by creating an NSMutableData. My question is that how I can ...
Ghasem Abdi's user avatar
0 votes
2 answers
407 views

URLSession concurrency issue for async calls

I am trying to implement upload mechanism for my application. However, I have a concurrency issue I couldn't resolve. I sent my requests using async/await with following code. In my application ...
atalayasa's user avatar
  • 3,360
0 votes
1 answer
128 views

How to share cookies between WebView and NSURLConnection?

Currently my non-visual crawl is built using NSUrlConnection. (I need to rewrite that to NSURlSession at some point.) My visual crawl/perform-login is built using WebView. (I am working on ...
Tom's user avatar
  • 3,597
1 vote
1 answer
114 views

Swift URL Session Response gets corrupted when using '&' symbol

I am developing iOS app, I am using URL Session method for make API calls. Api response gives one property which contains AWS s3 link for pdf document. What should happen: So in this app, I am ...
Trevo Fernando's user avatar
0 votes
1 answer
44 views

how to not get empty array in swift playground?

I'm getting response from API's but I am not able to get emails array back, what am I doing wrong? I tried to add DispatchQueue.main.asyn { emails.append(result.data.email) } but its the same result. /...
nitpaxy's user avatar
  • 67
0 votes
1 answer
147 views

NSURLSessionConfiguration and timeoutIntervalForResource for NSURLSessionDelegate didCompleteWithError

Wondering if someone can provide their two cents. Below code successfully triggers didCompleteWithError NSURLSessionDelegate method upon timeoutIntervalForResource timeout. NSURLSessionConfiguration *...
mshrestha's user avatar
  • 788
0 votes
0 answers
80 views

NSUrlSessionTaskDelegate DidSendBodyData totalBytesSent inaccurate

NSUrlSessionTaskDelegate DidSendBodyData totalBytesSent seems to indicate that upload progress is being reported out of order. I created a simple test with a single upload, and logged the value of ...
Magnetic Llama's user avatar
0 votes
1 answer
138 views

how can I use build URLCredential with 2 perm file?

I have one piece of python code that need to transfer into swift code. I see lots of example using URLSessionDelegate and URLCerdentital. I see the signure for URLCredential is .init(identity: <#T#...
jacobcan118's user avatar
  • 8,105
0 votes
1 answer
265 views

RapidApi and Swift

I do not understand, how I can implement a RapidApi in a Swift Project, what am I doing wrong? import Foundation let headers = [ "x-rapidapi-host": "community-open-weather-map.p....
treenera's user avatar
1 vote
1 answer
264 views

Running multiple NSURLSessionDataTask sequently and tracking their progress

Hi all I was just wondering how can I make serial download with NSURLSessionTask in order? what am I looking for is to download the first time once it finished go to the next one but no matter how I ...
Edi's user avatar
  • 13
1 vote
0 answers
35 views

NSURLConnection switch to NSURLSession returning 404 response

I am attempting to convert my project from using NSURLConnection to NSURLSession. However, after making the switch I cannot seem to get a response from the server. The returned response from the ...
brassmookie's user avatar
0 votes
2 answers
1k views

Limit API Calls to 40 per minute (Swift)

I have a limit of 40 URL Session calls to my API per minute. I have timed the number of calls in any 60s and when 40 calls have been reached I introduced sleep(x). Where x is 60 - seconds remaining ...
Paul's user avatar
  • 203
0 votes
2 answers
458 views

Using self as delegate in initializer for instance variable swift

I'm porting parts of an Objective-C framework to Swift, and I have an issue I can't think of how to fix. As part of one of the classes, I need to store a URLSession to access a remote API, and I would ...
beeselmane's user avatar
  • 1,140
0 votes
1 answer
209 views

How to use POST request to Firebase Firestore from swift?

I would like to use the Firestore REST API from Swift, because I am using Siri Shortcut Intents, where I am not able to use the native SDK. What I have tried so far is to create an URLSession with &...
Viktor Maric's user avatar
0 votes
2 answers
329 views

Stream Requests Uploads getting slow in iOS Background Session from iOS 15.x

I am working on an app which uses iOS NSURLSession background session to upload the data to the S3 server. From iOS 15.x, We have observed that transfer speed has become too slow (~10 kbps). Following ...
gauravs's user avatar
  • 21
0 votes
1 answer
951 views

How to determine Error response from Swift.Result and Enum

I created a method that uses Swift.Result to return an image and an Error from a URLSession. I also created an Enum for the errors. When a Swift.Result error is returned, how can I tell the difference ...
Lance Samaria's user avatar
1 vote
0 answers
113 views

Need clarification between URLError. dataNotAllowed and URLError.notConnectedToInternet

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
  • 111
0 votes
1 answer
217 views

URLSEssion Does not send any response

I was trying to learn the basics of networking with openweather api. Implemented a very basic struct like this. protocol WeatherManagerDelegate { func didUpdateWeather(_ weatherManager : ...
Ae Ri's user avatar
  • 185
0 votes
0 answers
470 views

How to check if one of URLSession tasks returned an error and if so to stop code execution?

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
1 answer
36 views

Obj-C POST JSON (body?)to endpoint problems

Using Postman on my Mac I have confirmed GET/POST works to my endpoint. On my iPad I am trying to do the same thing but only GET connects and returns data (just for testing). In Postman I have key of ...
malaki1974's user avatar
  • 1,605
0 votes
1 answer
112 views

How to add network fetch inside swift struct initializer

I'm trying to get data from an URL (1st network call), then make a 2nd network call to fetch image from the url in the first response, and present on tableview in swift. The json from 1st network call ...
RobotX's user avatar
  • 208
1 vote
0 answers
470 views

URLSession and URLCache not working as expected

For a GET request which is consistently the same (it has a query param too), I'm returning in the response this response header. Cache-Control: max-age=3600, private I'm creating a URLSession with ...
bandejapaisa's user avatar
  • 26.6k
0 votes
1 answer
222 views

Can't use URLSession with Swift on Watchkit

I have a problem when trying to fetch some data with swift on apple watch. When i try this code in Swift Playground it works well but when I put it in an WatchOS app it shows me this error : Error ...
MaxBrt18's user avatar
0 votes
0 answers
347 views

Timeout error when post public key string with URLSession

I am creating a rsa key pair and send the public key to my api. But the post request fails with Timeout error. Following is my function for the request: func perform<T: Decodable>(reqData: Data, ...
Panks's user avatar
  • 567
0 votes
3 answers
1k views

Is it possible to download any file app suspension or quiet mode in iOS?

I'm seeking a mechanism to download any file (video, audio) not only for app background but also for app suspension or quit mode. It is like an android youtube application, background download. That ...
AMIT's user avatar
  • 906
1 vote
0 answers
564 views

Is there a way to get the underlying NSURLErrorDomain (code) in React Native on iOS?

In our React Native app we use TrustKit for certificate pinning on iOS. If the certificate validation fails and I catch the error within the JavaScript context (example below), logging the error only ...
blwinters's user avatar
  • 1,961
0 votes
0 answers
882 views

How to properly cancel and restart an URLSessionDataTask Swift

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

Getting nil data when try to cancel a task and restart it again Swift

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,012
0 votes
2 answers
904 views

How to use OperationQueue to handle URLSessions for an image downloader

I'm trying to create a simple ImageDownloader framework in swift. What I'd like to achieve: Able to download images with given URLs Cache with url string So fetching just one image is no problem, I ...
RobotX's user avatar
  • 208
0 votes
0 answers
24 views

NSURLSessionDataTask completionHandler no longer executes when I switch to Release build configuration

I built a simple command line tool that fetches some data using an NSURLSessionDataTask. Now that I'm done coding, I find that the executable hangs when I switch to the Release build configuration in ...
Brian Crawford's user avatar
0 votes
0 answers
327 views

urlSession didSendBodyData reports wrong totalBytesExpectedToSend

The didSendBodyData method of URLSession delegate with uploadTask running is called with a wrong totalBytesExpectedToSend value. It seems to be about double of what it should be but not exactly. The ...
jab11's user avatar
  • 867
1 vote
0 answers
227 views

How to call HTTClient API call using iOS background session?

I have a requirement to create a background Task to fetch API calls, using Xamarin.iOS. The API calls are fetched using NSUrlSession CreateDownloadTask, was able to fetch the API contents without any ...
Jayasai Goutheman's user avatar
0 votes
2 answers
888 views

Using Swift with URLSession works with GET and PUT, but it gives error 405 Method Not Allowed when I use POST

I develop an iOS app using Swift. I use the following method below to access an login ENDPOINT with PUT method. let loginData = LoginModel("myUser","myPassword") var ...
fabiobh's user avatar
  • 715
2 votes
4 answers
6k views

How can I make a POST Request in Swift with parameters using URLSession

I have a post request that I want to make using URLSession. The post request looks like this: curl -X POST 'https://smartdevicemanagement.googleapis.com/v1/enterprises/privatekey/devices/devicekey:...
KARL's user avatar
  • 53

1
2 3 4 5
50