Cached scans
May 19, 2016

Cached scans
Scans can be stored locally (for uploading for analysis in the server later).
SampleFileUtils class allows you to store a scan object, and read and remove from local storage, using the following methods:

storeToDisk
This method has the following parameters:

  • Object- this is the scan object (CPScioReading).
  • fileName- to store the scan.

The method returns a boolean response for success/failure.

readArchiveWithFileName
This method has only one parameter:

  • fileName- of the scan that had been stored earlier.

The method returns a CPScioReading object of the scan.

removeFromDiskFileName
This method has only one parameter:

  • fileName- of the scan that had been stored earlier.

The method returns an NSError object that contains the error in case of a failure, or nil for success.

The following code sample stored a CPScioReading object (“_reading”)

[SampleFileUtils storeToDisk:_reading fileName:weakSelf.scanFileName];

The following code sample loads a CPScioReading object

CPScioReading *lastScan = [SampleFileUtils readArchiveWithFileName:self.scanFileName];

Leave a Reply