简体   繁体   English

无法打开文件 obj SceneKit

[英]Could not open file obj SceneKit

I have the problem "Could not open obj file".我有问题“无法打开 obj 文件”。 I'm a beginner in iOS development.我是 iOS 开发的初学者。

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)
    }

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.要解决它,您可以使用 async 完成下载过程,然后打开文件。

You can see my answer here: ios - Could not open OBJ file when convert MDLAsset to MDLMesh你可以在这里看到我的答案: ios - 将 MDLAsset 转换为 MDLMesh 时无法打开 OBJ 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM