ScannerApp-Swift Documentation

Class Http​Request​Handler

class HttpRequestHandler: NSObject  

handle http request related (e.g. upload, verify)

%11 HttpRequestHandler HttpRequestHandler NSObject NSObject HttpRequestHandler->NSObject URLSessionTaskDelegate URLSessionTaskDelegate HttpRequestHandler->URLSessionTaskDelegate

Conforms To

NSObject
URLSessionTaskDelegate

Initializers

Properties

Methods

upload(to​Upload:​)

func upload(toUpload url: URL)  

upload​One​File(url:​)

func uploadOneFile(url: URL)  

upload​All​Files​One​ByOne(file​Urls:​)

func uploadAllFilesOneByOne(fileUrls: [URL])  

under current setup, the "upload" button on the library view is essentially calling this function. This function uploads files specified by fileUrls from small to large recursively. A verify request is sent after each upload request complete

url​Session(_:​did​Become​Invalid​With​Error:​)

func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)  

print error message to console when the session become invalid due to an error

url​Session​Did​Finish​Events(for​Background​URLSession:​)

func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession)  

url​Session(_:​task:​did​Complete​With​Error:​)

func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)  

url​Session(_:​task:​did​Send​Body​Data:​total​Bytes​Sent:​total​Bytes​Expected​ToSend:​)

func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64)  

calculate upload progress for the file