N
N
NRO2015-04-05 18:34:09
Objective-C
NRO, 2015-04-05 18:34:09

Why does file download speed drop (objective-c)?

I am uploading files in the background thread, I will immediately make a reservation that the Internet is good. Files are loading very slowly. In the debugger, the load on the network does not exceed 100 kbps. pastebin.com/0pe2Yu3d

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2015-04-05
@NRO

I would be the person who, in the examples for demonstrating file uploads, initially used the dataWithContentsOfURL method: he broke off his hands. And all this has been dragging on for more than a year. What is not an example of how to upload files from the network is dataWithContentsOfURL. This is not what this method is for. It's written right in the comments.

Do not use this synchronous method to request network-based URLs. For network-based URLs, this method can block the current thread for tens of seconds on a slow network, resulting in a poor user experience, and in iOS, may cause your app to be terminated.
Instead, for non-file URLs, consider using the dataTaskWithURL:completionHandler: method of the NSSession class. See URL Loading System Programming Guide for details.

PS This is not an answer to the question why it slows down, here you need to run a profiler. This is the answer how to do it right.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question