Trouble loading a reference object from Asset Catalog

Hi,

I'm trying to test object recognition using ARKit. I scanned a couple of objects using the Apple demo app, copied the .arobject files to my laptop.

I added them to my new project in Assets like shown in the image.

However, as I follow the tutorial to load these objects to use as reference objects, I run into an error.

        let configuration = ARWorldTrackingConfiguration()
        guard let referenceObjects = ARReferenceObject.referenceObjects(inGroupNamed: "Test", bundle: Bundle.main) else {
            
            let ro = ARReferenceObject.referenceObjects(inGroupNamed: "Test", bundle: nil);
            let ro1 = ARReferenceObject.referenceObjects(inGroupNamed: "Gallery", bundle: .main);
            fatalError("Resource not found")
        }

Here, we fail the guard statement and the ro and ro1 both are set to nil.

I created a new project with just this one statement and that fails too.

I'm using SwiftUI instead of UIKit if that makes a difference and am calling this in the makeUIView() function .

Any pointers to what I might be doing wrong here are appreciated.

Hi Sravan!

There seems nothing wrong with the way you're attempting to load the reference objects. Can you please file a report on https://feedbackassistant.apple.com where you include the details of your setup (macOS build, Xcode version, iOS version running on the device). Please also attach the sample project where the issue reproduces.

Thank you!

Trouble loading a reference object from Asset Catalog
 
 
Q