iphone - 线程 1: EXC_BAD_ACCESS (code=1, address=0x48) - 被 iOS13.1 破坏了 (dev build 2)
问题描述
所以,我昨天将我的 iPhone 6S 更新到了 iOS13.1 的第二个开发版本,突然我的应用程序(在应用程序商店中,Connect 应用程序上显示 0 个崩溃)在我的设备上运行时无法运行。然而,它确实可以在 Xcode 的模拟器中工作。我使用的是 Xcode 10.3,但 Xcode 11 测试版做同样的事情,模拟器也可以在测试版上运行(尽管它们以其他方式破坏了我的应用程序)。
当我点击一个按钮时,应该将我带到所点击按钮的详细视图,我收到此错误:
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 很快就会出来。
请帮忙!
解决方案
如果您在声明中启动了“audioPlayer_GetReady”,如下所示:
var audioPlayer_GetReady = AVAudioPlayer()
尝试重组以仅声明其类型:
var audioPlayer_GetReady: AVAudioPlayer
您现在需要在您的类的 init 方法中对其进行初始化,或者,如果您确定它会在对其进行任何引用之前在其他地方进行初始化,请用感叹号声明它:
var audioPlayer_GetReady: AVAudioPlayer!
推荐阅读
- node.js - Sequelize require 函数不会创建模型
- django - 使用 Websockets 通过 Http 进行 Django 身份验证
- python - Pyinstaller exe 崩溃,没有任何错误消息
- javascript - 如何在 JavaScript 中设置打印样式
- javascript - 在 Vuejs 3 中使用有效负载的正确方法
- sql - Sqlite /过去x个日历日的日期列表
- javascript - 如何从对象中的子项获取父键
- c# - 在签名证书上添加属性 CRL
- glsl - 如何在 Vulkan 主机程序上创建共享缓冲区?
- javascript - 从子组件到子组件调用函数