Azeem Usmani
Azeem Usmani

Reputation: 614

Vision Text Recogniser giving nil result

I hope you are doing well, I am stuck with an strange problem. I have implemented Vision Text Recogniser and after successfully extract the image and assign that image to visionImage but I am getting error = nil and also the result = nil. There is nil coming in result block i have followed the google documentation link https://firebase.google.com/docs/ml-kit/ios/recognize-text . but the result is nil.

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
        if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {


            imgView.image = pickedImage

            // -----
            let visionImage = VisionImage(image: pickedImage)

            textRecognizer.process(visionImage) { (result, error) in

                guard error == nil, let result = result else {
                    // ...

                    return
                }

                print("THE RESULT", result?.text)

            // -----
        }
        dismiss(animated: true, completion: nil)
    }

Please help me with that or specify why reason of that nil coming in result block. so that I can fix it.

A big Thank you in advance, waiting for your response.

Regards, Azeem Usmani

Upvotes: 0

Views: 127

Answers (0)

Related Questions