【问题标题】:ios10 scenekit will crash when I click iphone's home button当我单击 iphone 的主页按钮时,ios10 scenekit 会崩溃
【发布时间】:2017-02-26 05:20:53
【问题描述】:

我使用第三方音乐播放器在后台播放音乐,然后我在 Xcode8、ios10 中运行此代码。效果很好。

let sceneView = SCNView(frame: self.view.bounds)
self.view.addSubview(sceneView)

let scene = SCNScene()
sceneView.scene = scene

let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()

scene.rootNode.addChildNode(cameraNode)

sceneView.allowsCameraControl = true
sceneView.showsStatistics = true

但是当我点击主页按钮时,我的应用程序会崩溃并且 我收到此错误:“由于未捕获的异常 'com.apple.coreaudio.avfaudio' 导致应用程序终止,原因:'error 561015905'”。

我不知道如何解决它。

【问题讨论】:

    标签: swift3 ios10 scenekit


    【解决方案1】:

    看起来像 SceneKit 错误。

    您可以尝试什么,只需访问scene.audioEngine 为了预热音频引擎(即使您的应用不使用音频)。

    【讨论】:

      【解决方案2】:

      561015905 代表错误 AVAudioSessionErrorCodeCannotStartPlaying。 Apple Docs 提供了详细信息 此错误为:“该应用程序不允许开始录制和/或 播放,通常是因为其 Info.plist 中缺少音频键。 如果应用程序具有此键但使用类别,也可能发生这种情况 无法在后台录制和/或播放 (AVAudioSessionCategoryAmbient, AVAudioSessionCategorySoloAmbient, 等)。”在使用锁定按钮时,我也遇到了同样的崩溃 使用 SceneKit 但不使用音频的应用程序。(来自评论 DancOfDeth 此处:What is Core Audio error 561015905 and why does it happen when I use the lock button?)

      它看起来像一个错误,请参阅以下链接中的相关错误报告:

      https://openradar.appspot.com/28455923-SceneKit/CoreAudio Crash when device is locked

      【讨论】:

        【解决方案3】:

        我已经解决了完全相同的问题

        try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-10-23
          • 2018-10-13
          • 2011-06-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多