【发布时间】:2015-06-12 08:00:02
【问题描述】:
我在向节点添加音频播放器时遇到了一些问题。出于某种原因,我遇到了一个异常并且我的应用程序停止了。这是我的代码的样子
let node = scene.rootNode.childNodeWithName("box", recursively: true)!
let source = SCNAudioSource(fileNamed: "test.mp3")
source.loops = true
source.volume = 2
source.positional = true
source.shouldStream = true
source.load()
let player = SCNAudioPlayer(source: source)
node.addAudioPlayer(player)
谁能帮我找出问题所在?
编辑:例外:
2015-06-12 10:44:29.202 asd[10480:2157476] 10:44:29.202 错误:AVAudioNodeImpl.h:39:AVAE_CheckNodeHasEngine:所需条件为假:_engine!= nil 2015-06-12 10:44:29.208 asd[10480:2157476] * 由于未捕获的异常“com.apple.coreaudio.avfaudio”而终止应用程序,原因:“所需条件为假:_engine!= nil” * 首先抛出调用栈: ( 0 CoreFoundation 0x000000010ca18885 异常预处理 + 165 1 libobjc.A.dylib 0x000000010e9afdf1 objc_exception_throw + 48 2 CoreFoundation 0x000000010ca186ea + [NSException raise:format:arguments:] + 106 3 libAVFAudio.dylib 0x0000000115549efe libAVFAudio.dylib + 98046 4 libAVFAudio.dylib 0x000000011558b4fd libAVFAudio.dylib + 365821 5 libAVFAudio.dylib 0x000000011558aaa5 libAVFAudio.dylib + 363173 6 场景套件 0x000000010d3695eb C3DTransactionFlush + 1967 7 场景套件 0x000000010d3699e9 C3DTransactionCommit + 218 8 场景套件 0x000000010d2f7f6e -[SCNRenderer setPointOfView:] + 4677 9 SceneKit 0x000000010d2f8c05-[SCNRenderer setScene:completionHandler:] + 213 10 SceneKit 0x000000010d354920 -[SCNView setScene:] + 319 11 asd 0x000000010c8338b2 _TFC3asd18GameViewController11viewDidLoadfS0_FT_T_ + 2866 12 asd 0x000000010c833ba2 _TToFC3asd18GameViewController11viewDidLoadfS0_FT_T_ + 34 13 UIKit 0x000000010d7bbd65-[UIViewController loadViewIfRequired] + 860 14 UIKit 0x000000010d7bc0b4 -[UIViewController 视图] + 27 15 UIKit 0x000000010d69f3d4-[UIWindow addRootViewControllerViewIfPossible] + 61 16 UIKit 0x000000010d69fad1 -[UIWindow _setHidden:forced:] + 302 17 UIKit 0x000000011c867717 UIKit + 247575 18 UIKit 0x000000010d6b0ff8 -[UIWindow makeKeyAndVisible] + 43 19 UIKit 0x000000010d63302b-[UIApplication_callInitializationDelegatesForMainScene:transitionContext:] + 3545 20 UIKit 0x000000010d638ef0-[UIApplication_runWithMainScene:transitionContext:completion:] + 1755 21 UIKit 0x000000010d63673f -[UIApplication 工作区DidEndTransaction:] + 188 22 前板服务 0x0000000116052d7b 前板服务 + 163195 23 前板服务 0x0000000116053118 前板服务 + 164120 24 核心基础 0x000000010c9430f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 25 核心基础 0x000000010c938eac __CFRunLoopDoSources0 + 556 26 核心基础 0x000000010c938363 __CFRunLoopRun + 867 27 核心基础 0x000000010c937d78 CFRunLoopRunSpecific + 488 28 UIKit 0x000000010d636091-[UIApplication_run] + 402 29 UIKit 0x000000010d63a79b UIApplicationMain + 171 30 asd 0x000000010c83624d 主 + 109 31 libdyld.dylib 0x000000010f3a0a05 libdyld.dylib + 10757 32 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib:以 NSException 类型的未捕获异常终止 (lldb)
【问题讨论】:
-
你遇到了什么异常?
标签: swift scenekit audio-player