我正在使用SceneKit和Collada文件.现在,我可以在art.scnassets文件夹中以及项目根目录中加载collada文件.我正在尝试从本地Web服务器加载文件时收到错误.有什么理由我不能这样做?
let url = NSURL(string: "http://localhost:8888/new.dae")
let scn = try! SCNScene(URL: url!, options: nil)
2016-07-31 17:41:29.537 biOS[3863:254446] SceneKit IO: error, COLLADA files are not supported on this platform.
fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=259 "The document "new.dae" could not be opened." UserInfo={NSURL=http://localhost:8888/new.dae, NSLocalizedDescription=The document "new.dae" could not be opened., NSLocalizedRecoverySuggestion=Collada is not supported by this version of SceneKit}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-703.0.18.8/src/swift/stdlib/public/core/ErrorType.swift, line 54
Run Code Online (Sandbox Code Playgroud)
我的目标是从websever读取collada文件,然后让用户将文件下载到设备上.我不知道为什么我得到错误.顺便说一下,我做了一个文档预览来渲染文件,并成功地在xml中渲染文档.因此,不是访问该文件的情况.请帮忙!
有什么理由我不能这样做?
是的,很不幸的.
在构建过程中,XCode会将您的collada编译为.scn文件.这是一个特定于场景的二进制文件格式,这样做可以减少资产文件的大小(collada文件是基于XML的),从而提高了负载性能.在iOS设备上运行的SceneKit不会加载collada文件,只加载.scn文件.
您可以使用ModelIO来加载不属于您的应用程序的资源,但我注意到collada不是受支持的格式之一.
| 归档时间: |
|
| 查看次数: |
1674 次 |
| 最近记录: |