Har*_*ker 2 assets swift watchkit
使用 WatchKit,尝试时
let asset = NSDataAsset(name:"ASSET-NAME")
Run Code Online (Sandbox Code Playgroud)
XCode 抛出以下错误 Use of unresolved identifier 'NSDataAsset'
那么如何使用 WatchKit 从资产目录中获取(声音)文件呢?
根据另一个线程,您可以获得您的音频文件
let filePath = Bundle.main.path(forResource: "fileName", ofType: "m4a")!
let fileUrl = URL(fileURLWithPath: filePath)
let asset = WKAudioFileAsset(URL: fileUrl)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4226 次 |
| 最近记录: |