Xcode Error: Ar Reference Image Must Have Non Zero Positive Width

How to add image on ar resource of asset file

After saving the image in assets, you need to give the name, width, height and units of the image. You can refer this

Xcode Error: AR reference image must have non zero positive width

Sample Image

ARKit image detection, add image

Assuming that referenceImage.name's value is the actual image filename.

if let imageName = referenceImage.name {
plane.materials = [SCNMaterial()]
plane.materials[0].diffuse.contents = UIImage(named: imageName)
}

The AR Session Failed. One or more reference images have an invalid size

Solution 1

This post

stated:

the error message is a bit missleading. Try setting your Deployment Target (in Unity or later in Xcode) to 12.0. This fixes the issue for me.

Which has fixed our issue.

Solution 2

Additionally, leaving our Deployment Target as is (10.0) and ensuring that the reference image is a .jpg has also solved this for us.



Related Topics



Leave a reply



Submit