按需资源放置。
大家好。我已经为按需资源设置了标签,我已经编写了代码来下载它,但我不知道如何访问它?使用迅速 3
下面是我的代码。
在我设置 ODR 之前,我从 main.bundle 获取音频。
try vox = AVAudioPlayer(contentsOf: URL(fileURLWithPath: Bundle.main.path(forResource: sV, ofType: "mp3")!))
try music = AVAudioPlayer(contentsOf: URL(fileURLWithPath: Bundle.main.path(forResource: sM, ofType: "mp3")!))
下载文件的代码。
request = NSBundleResourceRequest(tags: ["Stress"])
request.beginAccessingResources { (error) in
// Called on background thread
if error == nil {
OperationQueue.main.addOperation({ () -> Void in
})
}
}
我只是看不到下载后如何访问该文件?