Need some help with displaying text in ARKit

I have some code that recognizes some text from a camera and then takes that text and makes an amazon search and (sort of) gets the reviews.

The part I am struggling with right now is making the reviews show up on the user's camera.

Here is my current code: github repo

Feel free to run it to see how it works. You can see I already did some ARKit work in the viewDidLoad method of ViewController.swift but it keeps crashing when I try to run it on my iPhone with this exception: Thread 1: Exception: "-[UITextInputTraits length]: unrecognized selector sent to instance 0x1035332b0"

Basically I want the user to take a pic and the rating should show up on the user's camera (i have already got the rating, it isn't just displaying on the user's camera)

Thanks in advance.


I am not entirely certain what it is your app is supposed to do (not familiar enough with Amazon's API or what is being scanned to query the ratings), but I was able to generate AR text when testing your app. Specifically, in the configureOCR() function of your ViewController.swift file, I added a small debug, just after you handle the observation from the VNRecognizedTextObservation array;

Code Block
DispatchQueue.main.async {
self.ocrTextView.text = "Blah blah blah"
self.showARText()
}


(I added this on line 163, if that helps). Once I ran your app, scanned a document, and saved, the text was properly set to "Blah blah blah" and showARText was called successfully. I did not receive any errors and the text appeared in AR.

My guess is that something in the formatting of your response from the API call is causing an issue. I would try just setting the text of the ocrTextView to a default string for debug purposes, just to prove that your code works, and then backtrack and try to figure out why the URLSession/parsing is causing the error. Subsequently, it may also be worth saving the desired "AR text" to its own string variable, rather than trying to generate the SCNText object from the text property of your subclassed UITextView (I'm not sure why it should matter, but you're just adding more possible failure points by having to worry about the OcrTextView initializing properly and dealing with all of the auto layout and UI setup, when all you're after is the text).
Need some help with displaying text in ARKit
 
 
Q