Friday, February 3, 2023
HomeiOS Developmentswift - iOS/Basis URLSession add infinite-loops

swift – iOS/Basis URLSession add infinite-loops

I am first going to ask this with out full listings and logs, as a result of it feels just like the kind of factor that folks may acknowledge generically from their very own work.

iOS 16 simulator, Xcode 14.2.


I wish to add a file to a REST server. I am utilizing URLSessionUploadTask. HTTP Fundamental authentication goes by (by the low-level reality that after I present fundamental creds, URLSession stops asking).

I can assume that the bytes are getting there: My activity delegate’s urlSession(_:activity:didSendBodyData:... known as with the precise variety of bytes, and equal to the anticipated variety of bytes. I assume that is not a rely of what was forged into the web, however the product of some consumer/server acknowledgement.

The minor odd factor is that I see in my logs is first the server-trust auth problem, then the did-send, and solely then HTTPBasic.

∞ Loop

The main odd factor is:

didReceive problem: NSURLAuthenticationMethodServerTrust
didSend: 296 / 296
didReceive problem: NSURLAuthenticationMethodHTTPBasic
didReceive problem: NSURLAuthenticationMethodServerTrust
didSend: 592 / 592
didReceive problem: NSURLAuthenticationMethodHTTPBasic

… and so forth, advert infinitum, accumulating by multiples of the entire knowledge. I admit I’ve not checked the arithmetic on payload measurement, I believe that the rely isn’t essentially common-sensical. When you have some expertise to which the counts are vital, I am glad to listen to from you.

The delegate strategies for end-of-transfer, success or failure, are by no means known as. The closure argument for URLSession.shared.dataTask… is rarely known as.

The server’s itemizing web page doesn’t present the file current.

Complement: Multipart

Content material-Sort: multipart/form-data; boundary=593FBDC3-7A99-415D-B6B4-3F553CB6C9C2
Content material-Disposition: form-data; title="file"; filename=""
Content material-Sort: utility/zip


I cam’t assist the discussion board’s line-wrapping. The linebreaks I intend are rn, per the overall normal. “0123456” is part of this package deal as Knowledge containing that string. I’m wondering if the promise of .zip content material with out precise .zip-formatted knowledge is an issue. I hadn’t thought J. Random Apache could be that “useful.”

Oh, and:

My add activity calls .resume() as soon as and solely as soon as. Devices exhibits no hotspot or deep stack into my code, which I might count on in a coded infinite loop.



Please enter your comment!
Please enter your name here

four + sixteen =

Most Popular

Recent Comments