Мое приложение собирается и работает нормально, пока я не попытаюсь добавить в него проигрыватель аудиофайлов. Когда я делаю это, происходит сбой.
Я пробовал разные способы добавления плеера - с «без попытки» и с другой проверкой ошибок. Я также скопировал и вставил код проигрывателя аудиофайлов из других приложений, созданных мной для этой работы.
let myfile = try? AKAudioFile(readFileName: "bassClipCR.wav")
player = AKPlayer(audioFile: myfile!)
player.isLooping = true
player.buffering = .always
player.play()
print("Player started")
Вот трассировка стека:
2019-10-16 15:29:21.741883-0400 Filter Effects Moogy[60912:1536960] [plugin] AddInstanceForFactory: No factory registered for id F8BB1C28-BAE8-11D6-9C31-00039315CD46
2019-10-16 15:29:21.766869-0400 Filter Effects Moogy[60912:1536960] [avae] AVAEInternal.h:76 required condition is false: [AVAudioPlayerNode.mm:568:StartImpl: (_engine->IsRunning())]
2019-10-16 15:29:21.778671-0400 Filter Effects Moogy[60912:1536960] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: _engine->IsRunning()'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23baa1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50864b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23ba9f68 +[NSException raise:format:arguments:] + 88
3 AVFAudio 0x00007fff209ee1c7 _Z19AVAE_RaiseExceptionP8NSStringz + 156
4 AVFAudio 0x00007fff209ee0e0 _Z11_AVAE_CheckPKciS0_S0_b + 326
5 AVFAudio 0x00007fff20a81cc6 _ZN21AVAudioPlayerNodeImpl9StartImplEP11AVAudioTime + 432
6 AVFAudio 0x00007fff20a7f758 -[AVAudioPlayerNode play] + 60
7 Filter Effects Moogy 0x000000010dc9edd6 $s8AudioKit8AKPlayerC4play4from2to2at8hostTimeySd_SdSo07AVAudioI0CSgs6UInt64VSgtF + 710
8 Filter Effects Moogy 0x000000010dcbc6f2 $s8AudioKit8AKPlayerC4playyyFTo + 146
9 Filter Effects Moogy 0x000000010dada180 $s20Filter_Effects_Moogy14ViewControllerC11viewDidLoadyyF + 1248
10 Filter Effects Moogy 0x000000010dadad5b $s20Filter_Effects_Moogy14ViewControllerC11viewDidLoadyyFTo + 43
11 UIKitCore 0x00007fff46f03d96 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
12 UIKitCore 0x00007fff46f08cef -[UIViewController loadViewIfRequired] + 1084
13 UIKitCore 0x00007fff46f0910c -[UIViewController view] + 27
14 UIKitCore 0x00007fff475b0241 -[UIWindow addRootViewControllerViewIfPossible] + 150
15 UIKitCore 0x00007fff475af8f5 -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 232
16 UIKitCore 0x00007fff475b09b5 -[UIWindow _setHidden:forced:] + 362
17 UIKitCore 0x00007fff475c3d61 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
18 UIKitCore 0x00007fff475714fa -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4199
19 UIKitCore 0x00007fff47576f6e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1281
20 UIKitCore 0x00007fff46cbc3ed -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
21 UIKitCore 0x00007fff471a4aa9 _UIScenePerformActionsWithLifecycleActionMask + 83
22 UIKitCore 0x00007fff46cbceff __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
23 UIKitCore 0x00007fff46cbc90e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296
24 UIKitCore 0x00007fff46cbcd2c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818
25 UIKitCore 0x00007fff46cbc5c1 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
26 UIKitCore 0x00007fff46cc0bef __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178
27 UIKitCore 0x00007fff470ca9d7 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 865
28 UIKitCore 0x00007fff471c2fa7 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
29 UIKitCore 0x00007fff46cc090a __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
30 UIKitCore 0x00007fff471c2eaa _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
31 UIKitCore 0x00007fff46cc0778 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
32 UIKitCore 0x00007fff46b1ac67 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
33 UIKitCore 0x00007fff46b197ec -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248
34 UIKitCore 0x00007fff46b1a991 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
35 UIKitCore 0x00007fff475755cb -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535
36 UIKitCore 0x00007fff470ec535 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
37 FrontBoardServices 0x00007fff364e0361 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
38 FrontBoardServices 0x00007fff365065f8 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
39 FrontBoardServices 0x00007fff364eae41 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
40 FrontBoardServices 0x00007fff36506289 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
41 libdispatch.dylib 0x000000010f2d3d6c _dispatch_client_callout + 8
42 libdispatch.dylib 0x000000010f2d6cdd _dispatch_block_invoke_direct + 300
43 FrontBoardServices 0x00007fff3652c49e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
44 FrontBoardServices 0x00007fff3652c18c -[FBSSerialQueue _queue_performNextIfPossible] + 441
45 FrontBoardServices 0x00007fff3652c69b -[FBSSerialQueue _performNextFromRunLoopSource] + 22
46 CoreFoundation 0x00007fff23b0d271 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
47 CoreFoundation 0x00007fff23b0d19c __CFRunLoopDoSource0 + 76
48 CoreFoundation 0x00007fff23b0c974 __CFRunLoopDoSources0 + 180
49 CoreFoundation 0x00007fff23b0767f __CFRunLoopRun + 1263
50 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438
51 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65
52 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621
53 Filter Effects Moogy 0x000000010dae564b main + 75
54 libdyld.dylib 0x00007fff516ecd29 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Что должно произойти, это то, что приложение должно открыться в симуляторе при воспроизведении звукового файла. Что происходит, так это то, что приложение открывается, а затем внезапно падает, не издавая ни звука. Я также получаю поток 1: сигнал SIGABRT в объявлении класса AppDelegate.