尝试获取捆绑包网址时发生错误 [英] Error called trying to get Bundle URL
本文介绍了尝试获取捆绑包网址时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试获取我拥有的音频文件的路径时出现错误。
I am getting an error when I try to get a path of an audio file I have.
let path = Bundle.main.path(forResource: "SaveALife", ofType: "mp3")!
在控制台中,我收到以下消息:
In the console I receive this:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
有帮助吗?谢谢。
推荐答案
确保SaveALife.mp3应该在您的捆绑包中。另外,当您拖放文件时,请检查复制包资源。
Make sure SaveALife.mp3 should be in your bundle. Also when you drag and drop the file please check copy bundle resources.
这篇关于尝试获取捆绑包网址时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文