gpt4 book ai didi

ios - SCNAction playAudio似乎导致崩溃

转载 作者:行者123 更新时间:2023-11-29 13:53:09 28 4
gpt4 key购买 nike

我看到的是SceneKit中的崩溃,这是我在iOS 13.1.2之前没有看到的。

我已将问题追查到以下功能,无法完全推测出导致问题的原因。

如果我注释掉在节点上运行操作的行,一切就很好。

我可以在场景中其他先前存在的节点上运行playAudio Action ,但是当我只想使用以下功能一次播放一次声音时,该应用就会崩溃。

所以我的想法是,这可能与我实例化该节点的方式有关,但是我无法想到另一种实例化节点的方法,该方法只是在给定位置播放声音。

我也尝试过使用回收的音频源,但这没什么区别。

可能有人对这个代码可能导致崩溃的情况有任何想法吗?这对我来说并不明显,尤其是因为它在iOS更新之前已经完美地运行了。

我在下面包括了回溯图。

非常感谢您的帮助/想法!

周末愉快!

干杯!

func play(sound: String, atPosition: SCNVector3, volume: Float, pitch: Float, loops: Bool, positional: Bool) {

// Sources will be pre-loaded and recycled for the finished app

if let source = SCNAudioSource(fileNamed: "art.scnassets/"+sound)
{
source.volume = volume
source.rate = pitch
source.isPositional = positional
source.shouldStream = false
source.loops = loops
source.load()

let node = SCNNode()

node.name = "oneShot"

node.position = atPosition

scnScene.rootNode.addChildNode(node)

// node.runAction(SCNAction.sequence([SCNAction.playAudio(source, waitForCompletion: true), SCNAction.removeFromParentNode()]))

// This line causes the crash

node.runAction(SCNAction.playAudio(source, waitForCompletion: false))

}

}
  • 线程#14,名称='com.apple.scenekit.scnview-renderer',队列='com.apple.scenekit.renderingQueue.SCNView0x105a11e90',停止原因= EXC_BAD_ACCESS(代码= 1,地址= 0x830b67ea0)
  • 帧#0:0x00000001b08d7030 libobjc.A.dylib objc_retain + 16
    frame #1: 0x00000001bd5a90c4 AVFAudio
    -[AVAudioPlayerNode didAttachToEngine:] + 140
    帧#2:0x00000001bd5b66e8 AVFAudio AVAudioEngineImpl::AttachNode(AVAudioNode*, bool) + 272
    frame #3: 0x00000001bd5b2324 AVFAudio
    -[AVAudioEngine attachNode:] + 80
    框架#4:0x00000001c4aea48c SceneKit CPP3DAudioContext::AddVoice(void const*) + 120
    frame #5: 0x00000001c4aeacf0 SceneKit
    CPP3DAudioEngine::AddVoice(void const *)+ 192
    框架6:0x00000001c49bd618 SceneKit C3DNodeAddAudioPlayer + 40
    frame #7: 0x00000001c4a07924 SceneKit
    -[SCNNode addAudioPlayer:] + 132
    框架#8:0x00000001c49325e0 SceneKit SCNCPlaySound::cpp_updateWithTargetForTime(SCNNode*, double) + 96
    frame #9: 0x00000001c499c690 SceneKit
    SCNActionApply + 112
    框架#10:0x00000001c4a2d7a4 SceneKit _applyActions + 236
    frame #11: 0x00000001b0a8e1b8 CoreFoundation
    -[ NSFrozenDictionaryM __apply:context:] + 128
    帧#12:0x00000001c4a2d5c8 SceneKit C3DAnimationManagerApplyActions + 104
    frame #13: 0x00000001c4a173e4 SceneKit
    -[SCNRenderer _update:] + 576
    框架#14:0x00000001c4a19a04 SceneKit -[SCNRenderer _drawSceneWithNewRenderer:] + 200
    frame #15: 0x00000001c4a19fbc SceneKit
    -[SCNRenderer _drawScene:] + 48
    帧#16:0x00000001c4a1a350 SceneKit -[SCNRenderer _drawAtTime:] + 616
    frame #17: 0x00000001c4ab46b8 SceneKit
    -[SCNView _drawAtTime:] + 428
    帧#18:0x00000001c497ae38 SceneKit __69-[NSObject(SCN_DisplayLinkExtensions) SCN_setupDisplayLinkWithQueue:]_block_invoke + 56
    frame #19: 0x00000001c4a7fe48 SceneKit
    __36- [SCNDisplayLink _callbackWithTime:] _ block_invoke + 64
    框架#20:0x0000000105726c04 libdispatch.dylib _dispatch_client_callout + 16
    frame #21: 0x0000000105735888 libdispatch.dylib
    _dispatch_lane_barrier_sync_invoke_and_complete + 124
    帧#22:0x00000001c4a7fdd8 SceneKit -[SCNDisplayLink _callbackWithTime:] + 232
    frame #23: 0x00000001058f95f8 GPUToolsCore
    -[DYDisplayLinkInterposer forwardDisplayLinkCallback:] + 168
    帧#24:0x00000001b73da514 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 632
    frame #25: 0x00000001b1acdeb0 IOKit
    IODispatchCalloutFromCFMessage + 488
    框架#26:0x00000001b0ae96d4 CoreFoundation __CFMachPortPerform + 172
    frame #27: 0x00000001b0b12e5c CoreFoundation
    __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
    + 56
    框架#28:0x00000001b0b12588 CoreFoundation __CFRunLoopDoSource1 + 444
    frame #29: 0x00000001b0b0d45c CoreFoundation
    CFRunLoopRun + 2168
    框架#30:0x00000001b0b0c8bc CoreFoundation CFRunLoopRunSpecific + 464
    frame #31: 0x00000001b0e4c994 Foundation
    -[NSRunLoop(NSRunLoop)runMode:beforeDate:] + 228
    帧#32:0x00000001c497b214 SceneKit __71-[SCNView(SCNDisplayLink) _initializeDisplayLinkWithCompletionHandler:]_block_invoke + 456
    frame #33: 0x00000001c497b45c SceneKit
    __SCNRenderThread_start
    + 96
    框架#34:0x00000001b08b11ec libsystem_pthread.dylib`_pthread_start + 124
  • 最佳答案

    我只是想更新我的问题,说这个问题在更新到iOS 13.2后已经解决了。 -谢谢苹果。 :)

    关于ios - SCNAction playAudio似乎导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58457427/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com