I installed Tesseract library using cocoapods (pod 'TesseractOCRiOS', '4.0.0'
) and imported it in the code without problems,
I used the following code to read a text from an image
let tesseract:G8Tesseract = G8Tesseract(language:"eng+ita")
tesseract.delegate = self
tesseract.charWhitelist = "01234567890"
tesseract.image = image
tesseract.recognize()
print(tesseract.recognizedText)
After running it crashes on the first line, the error is:
fatal error: unexpectedly found nil while unwrapping an Optional value
Any and all help is appreciated.
Your code seems right. You can try to use if-let condition to check the optional statement. Also have a look, if you aren't already, in this example.
if let tesseract:G8Tesseract = G8Tesseract(language:"eng+ita") {
// Continue with you code.
}