1

I have the problem "Could not open obj file". I'm a beginner in iOS development.

func loadObj() {
    let url = URL(string: "http://ec2-34-212-108-22.us-west-2.compute.amazonaws.com/model/2018_02_28_22_48_43_ae16dacf5b0efe6985768ab1810f60fe_2018_02_28_22_48_43.obj")
    let idleScene = try! SCNScene(url:url!)
    let node = SCNNode()
    for child in idleScene.rootNode.childNodes {
        node.addChildNode(child)
    }
rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

1

Your issue is that you open the file before the download process is finished. To solve it, you can use async to finish the download process then opening the file.

You can see my answer here: ios - Could not open OBJ file when convert MDLAsset to MDLMesh

Khoa
  • 1,738
  • 1
  • 14
  • 21