因此,我昨天将我的iPhone 6S更新到iOS13.1的第二个开发版本,并且突然间,我的应用(在应用商店中显示为0崩溃的应用在Connect应用上)在运行时无法正常工作我的设备。 确实,但是可以在Xcode的模拟器中使用。我使用的是Xcode 10.3,但Xcode 11 Beta的功能相同,模拟器也可以在Beta上运行(尽管它们以其他方式破坏了我的应用程序)。
当我点击一个按钮时,应该使我进入所点击按钮的详细信息视图,我得到了这个错误:
Thread 1: EXC_BAD_ACCESS (code=1, address=0x48)
这是哪个代码
// sets up the audio for use in the app --------------------------------------------------------------//
let GetReady = Bundle.main.path(forResource: “Get_Ready_up9db”, ofType: “m4a”)
// this tells the compiler what to do when action is received
do {
audioPlayer_GetReady = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: GetReady! )) // Thread 1: EXC_BAD_ACCESS (code=1, address=0x48)
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.ambient)))
try AVAudioSession.sharedInstance().setActive(true)
}
catch{
print(error)
}
我不知道为什么突然这么做,但是因为我不知道为什么,我有点害怕,因为我确定iOS 13很快就会问世。
请帮助!
答案 0 :(得分:5)
如果您在这样的声明中启动了“ audioPlayer_GetReady”:
var audioPlayer_GetReady = AVAudioPlayer()
尝试重组以仅声明其类型:
var audioPlayer_GetReady: AVAudioPlayer
您现在需要在类的初始化方法中对其进行初始化,或者,如果您确定在对其进行任何引用之前会在其他地方对其进行初始化,请使用惊叹号对其进行声明:
var audioPlayer_GetReady: AVAudioPlayer!