EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) 从 Bundle 加载错误
EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) error loading from Bundle
我制作一个计算器只是为了好玩,我想在您按下按钮时添加声音。
错误是:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
在这行代码中:
let alertSound = URL(fileURLWithPath: Bundle.main.path(forResource: "219069_annabloom_click1", ofType: "wav")!)
我觉得问题出在这里
let alertSound = URL(fileURLWithPath: Bundle.main.path(forResource: "219069_annabloom_click1", ofType: "wav")!)
这个符号的意思是!
值不为零。
但我认为您没有正确添加文件,或者 .wav 扩展名存在问题,请仔细检查它 returns nil 并且应用程序崩溃。
Step 1: make sure you have added sound file correctly
Step 2: verify extension is same in code and file
确保选择了模块
我制作一个计算器只是为了好玩,我想在您按下按钮时添加声音。
错误是:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
在这行代码中:
let alertSound = URL(fileURLWithPath: Bundle.main.path(forResource: "219069_annabloom_click1", ofType: "wav")!)
我觉得问题出在这里
let alertSound = URL(fileURLWithPath: Bundle.main.path(forResource: "219069_annabloom_click1", ofType: "wav")!)
这个符号的意思是!
值不为零。
但我认为您没有正确添加文件,或者 .wav 扩展名存在问题,请仔细检查它 returns nil 并且应用程序崩溃。
Step 1: make sure you have added sound file correctly
Step 2: verify extension is same in code and file
确保选择了模块