1

I created a .reality file which i exported from Reality Composer and added to the project.

The code:

class ViewController: UIViewController {

@IBOutlet var arView: ARView!

    override func viewDidLoad() {
        super.viewDidLoad()
    
        if let anchor = try? Entity.loadAnchor(named: "ARAnchorTestFile") {
             arView.scene.addAnchor(anchor)
        }
    }
}

On devices with iOS version 13.5 or higher the app crash when the anchoring is triggered and the 3D model should be displayed.

The error:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x40)

The entire project has been uploaded to this repo: https://github.com/evjand/ARAnchorTest

UPDATE: After filing a bug repport to Apple it seems like they have fixed it in the iOS 14 beta.

Magnus T
  • 220
  • 1
  • 9

1 Answers1

1

Seems there's a bug when reading .reality file. Use .rcproject format instead. It works.

if let anchor = try? Entity.loadAnchor(named: "AR") {            
    arView.scene.addAnchor(anchor)
    print(anchor)
}

enter image description here

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • 1
    Loading the .reality file works on my device running on iOS 13.3. Hopefully apple solves this soon – Magnus T Aug 16 '20 at 19:52
  • Filed a bug report to Apple. Its been solved in iOS 14 beta – Magnus T Aug 25 '20 at 09:10
  • I have the same issue. It works with `named` but not with `Entity.loadAnchor(contentsOf: url, ...`, any idea why? – Auryn Feb 15 '21 at 16:04
  • i posted my question extra: maybe one of you have an idea https://stackoverflow.com/questions/66211539/load-rcproject-from-local-directory – Auryn Feb 15 '21 at 16:16