File Download basic steps:
1. Get the download link to create a response send request. (Use asynchronous requests to avoid blocking the main thread because the file is too large to download for a long time).
2. Create a file in the download directory when the response is received. create files using Nsfilehandle for internal file processing. (Verify that the file exists-write to the file using the Filehandleforwritingatpath method that Nsfilemanager creates the file--nsfilehandle).
3. When the data is received, the data received by the segment is written to the file
4. When the file is received, close the Nsfilehandle.
The above is the normal download step, here without code demonstration, the following to implement the breakpoint download function as an example.
Because the sandbox path is used frequently in this program, a get sandbox path method is provided first
Download Event
Pause Event
#pragma Mark---nsurlconnectiondatasource---
This completes the download and the breakpoint continues the download process!!!
ios-Server file Breakpoint download