Initialization
This page covers the description of the initialization process
Demo license can be obtained here: https://licensing.regulaforensics.com.
The initialization of Document Reader is performed fully offline. The initializeReader
method process license as NSData, i.e. no matter when it's put to the project before the application is compiled or after. Here is an example of how to perform initialization with the license that is put to the resources of the project:
Initialization without databasePath
guard let dataPath = Bundle.main.path(forResource: "regula.license", ofType: nil) else { return }
guard let licenseData = try? Data(contentsOf: URL(fileURLWithPath: dataPath)) else { return }
DocReader.shared.initializeReader(license: licenseData) { (success, error) in
if success {
// DocumentReader successfully initialized
} else {
// DocumentReader not initialized
print(error)
}
}
Initialization with databasePath
guard let dataPath = Bundle.main.path(forResource: "regula.license", ofType: nil) else { return }
guard let licenseData = try? Data(contentsOf: URL(fileURLWithPath: dataPath)) else { return }
guard let dbDat = Bundle.main.path(forResource: "db.dat", ofType: nil) else { return }
DocReader.shared.initializeReader(license: licenseData, databasePath: dbDat) { (success, error) in
if success {
// DocumentReader successfully initialized
} else {
// DocumentReader not initialized
print(error)
}
}
Last updated
Was this helpful?