Hello,
We are also facing the same issue. Upon testing, we found that as soon as avaudiosession setactive becomes false, there is no way to get audio from Skaction playsoundfilenamed during the app.
Further testing found that, minimizing maximizing the app, twice, brings back the audio. Which is hope giving but not the solution.
So whatever the system is doing during that two times of minimize and maximize needs to be done in ended of handleinterruption so as to get back audio. Or get back audio after setActive false of a AvAudioSession. SetActive true during app does not works only that after setting true , this minimize/maximize things work.
have tested Scenekit, Realitykit, Spritekit audio , 3rd party audioengine for our audio needs. Scenekit audio works with phone calls fine but has some memory issues which can be managed but not as ideal as spritekit.
Realitykit audio is great but handling memory is scary sometimes and the above issue happens but can be removed by creating a new instance ( but memory increases with app minimize maximize which can be resolved with singleton then) which is not working with spritekit as some allocation of playsoundfilenamed is persitent within the app. Does not deallocates.
3rd party audioengines crash sometimes on phone call. Atleast Apple APi's dont crash. Hopefully this gets resolved and will be a great thing if there are no more issues also.
Post
Replies
Boosts
Views
Activity
Hi, I am using AVAudioengine for my game as well. In which i need for 5 sounds out of which 4 are same sounds just played one after another very fast.
95% of times, the sounds are working correctly.
But when sometimes, i use a lots of other competitor apps, games and return to my own app, i hear the sounds becoming glitchy in my app.
And as soon as i press lock button to use siri and return back instantly, the sounds start working correctly.
Similarly, this happens when we lock the device and come back to the app, which also rectifies the issue.
I tried serialqueues, global sync ( because the sounds are coming rapidly one after another), reduced CPU/memory loads drastically, tried recreating audio files in interruptions, appdidbecomeactive. didnt resolve.
Am using playback audio category for my app. Though when removed the audio category setup, this issue also happens on default setup of audio which ios provides for the app. Tried removing mixwithothers, didnt resolve.
Tried almost everything but i cant resolve this issue.
Even replaced the library of audio with a low latency one. that low latency sounds are working fine but taking lots of memory.
The Avaudioplayer setup keeps the memory not too much.
What could be the reason for this audio getting correct on opening siri and back and also on lock screen lock and unlock?
Hi, I have preparetoplay function called as soon as init is created of the sound file.
I play it later.
95% of times, the sounds are working correctly.
But when sometimes, i use a lots of other competitor apps, games and return to my own app, i hear the sounds becoming glitchy in my app. And as soon as i press lock button to use siri and return back instantly, the sounds start working correctly.
Similarly, this happens when we lock the device and come back to the app, which also rectifies the issue.
I tried serialqueues, global sync ( because the sounds are coming rapidly one after another), reduced CPU/memory loads drastically, tried recreating audio files in interruptions, appdidbecomeactive.
Am using playback audio category for my app. Though when removed the audio category setup, this issue also happens on default setup of audio which ios provides for the app.
Tried removing mixwithothers, didnt resolve.
Tried almost everything but i cant resolve this issue.
Even replaced the library of audio with a low latency one. that low latency sounds are working fine but taking lots of memory.
The Avaudioplayer setup keeps the memory not too much.
What could be the reason for this audio getting correct on opening siri and back and also on lock screen lock and unlock?
Hi,
We are also seeing similar crash, dont know the reason why this is happening. Have you found a solution to it ? Or can any one provide a solution to this. We are seeing these in release version. like once or twice in a month.
0 CoreFoundation 0x18d604f20 __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x18548f2b8 objc_exception_throw + 60 (objc-exception.mm:356)
2 UIKitCore 0x190814604 __66-[UIStoryboardPushSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 880 (UIStoryboardPushSegueTemplate.m:58)
3 UIKitCore 0x190818dbc -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 172 (UIStoryboardSegueTemplate.m:134)
4 UIKitCore 0x190818cdc -[UIStoryboardSegueTemplate _perform:] + 68 (UIStoryboardSegueTemplate.m:121)
5 UIKitCore 0x1900e658c -[UIViewController performSegueWithIdentifier:sender:] + 300 (UIViewController.m:5598)
6 OurAppName 0x102154a78 ViewController.tableView(_:didSelectRowAt:) + 568 (ViewController.swift:0)
7 OurAppName 0x102154c38 @objc ViewController.tableView(_:didSelectRowAt:) + 136 (<compiler-generated>:0)
8 UIKitCore 0x18fab7904 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] + 1232 (UITableView.m:9323)
9 UIKitCore 0x190876af4 -[UITableView _userSelectRowAtPendingSelectionIndexPath:animatedSelection:] + 268 (UITableView.m:9377)
10 UIKitCore 0x190876bf4 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 216 (UITableView.m:9396)
11 UIKitCore 0x18f8bd5d8 -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:137)
12 UIKitCore 0x18f8bd49c -[_UIAfterCACommitQueue flush] + 164 (_UIAfterCACommitQueue.m:228)
13 UIKitCore 0x18f8bd3b4 _runAfterCACommitDeferredBlocks + 496 (UIApplication.m:3144)
14 UIKitCore 0x18f8bcfec _cleanUpAfterCAFlushAndRunDeferredBlocks + 80 (UIApplication.m:3108)
15 UIKitCore 0x18f8bcefc _UIApplicationFlushCATransaction + 72 (UIApplication.m:3185)
16 UIKitCore 0x18f8ba660 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:119)
17 UIKitCore 0x18f8ba2a4 schedulerStepScheduledMainSection + 172 (_UIUpdateScheduler.m:1058)
18 UIKitCore 0x18f8bb148 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1221)
19 CoreFoundation 0x18d5d7834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
20 CoreFoundation 0x18d5d77c8 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
21 CoreFoundation 0x18d5d5298 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
22 CoreFoundation 0x18d5d4484 __CFRunLoopRun + 828 (CFRunLoop.c:2955)
23 CoreFoundation 0x18d5d3cd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
24 GraphicsServices 0x1d20211a8 GSEventRunModal + 164 (GSEvent.c:2196)
25 UIKitCore 0x18fc0dae8 -[UIApplication _run] + 888 (UIApplication.m:3713)
26 UIKitCore 0x18fcc1d98 UIApplicationMain + 340 (UIApplication.m:5303)
27 OurAppName. 0x10212b228 main + 64 (AppDelegate.swift:21)
28 dyld 0x1b0dab154 start + 2356 (dyldMain.cpp:1298)
So many crashes of presentViewController, we are seeing from Nov 2023.
Two of them were because of viewWillTransition and UIAlertController, so we fully removed these two from our app.
But now, after removing , we saw this issue popping up again showing GameCenterUI.
Last Exception Backtrace:
0 CoreFoundation 0x193c28f20 __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x18bad2018 objc_exception_throw + 60 (objc-exception.mm:356)
2 UIKitCore 0x196394154 -[UIViewController _presentViewController:withAnimationController:completion:] + 4272 (UIViewController.m:0)
3 UIKitCore 0x1963957e4 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 88 (UIViewController.m:9733)
4 UIKitCore 0x19638f81c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 484 (UIViewController.m:9999)
5 UIKitCore 0x19638f544 -[UIViewController _presentViewController:animated:completion:] + 188 (UIViewController.m:9740)
6 UIKitCore 0x19638f3d8 -[UIViewController presentViewController:animated:completion:] + 164 (UIViewController.m:9936)
7 GameCenterUICore 0x21941d91c -[GKLocalPlayer(iOSAuthenticationUI) showViewController:usingPresentingViewController:wrapInNavController:] + 492 (GKLocalPlayer+iOSAuthenticationUI.m:87)
8 GameCenterUI 0x1bc2db5f8 __87-[GKLocalPlayer(AuthenticationExtras) showOnboardingUIFromViewController:signInOrigin:]_block_invoke.20 + 64 (GKLocalPlayer+AuthenticationExtras.m:248)
9 libdispatch.dylib 0x19bacddd4 _dispatch_client_callout + 20 (object.m:576)
10 libdispatch.dylib 0x19bad12d8 _dispatch_continuation_pop + 600 (queue.c:321)
11 libdispatch.dylib 0x19bae51c8 _dispatch_source_latch_and_call + 420 (source.c:596)
12 libdispatch.dylib 0x19bae3d8c _dispatch_source_invoke + 832 (source.c:961)
13 libdispatch.dylib 0x19badc4b4 _dispatch_main_queue_drain + 748 (queue.c:7898)
14 libdispatch.dylib 0x19badc1b8 _dispatch_main_queue_callback_4CF + 44 (queue.c:8058)
15 CoreFoundation 0x193bfb710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
16 CoreFoundation 0x193bf8914 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
17 CoreFoundation 0x193bf7cd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
18 GraphicsServices 0x1d8aa81a8 GSEventRunModal + 164 (GSEvent.c:2196)
19 UIKitCore 0x19623090c -[UIApplication _run] + 888 (UIApplication.m:3713)
20 UIKitCore 0x1962e49d0 UIApplicationMain + 340 (UIApplication.m:5303)
21 MyApp 0x102875f7c main + 64 (AppDelegate.swift:20)
22 dyld 0x1b72a9e4c start + 2240 (dyldMain.cpp:1298)
After adding GameCenter 72 days ago and 60k session, we see this crash. Surprising , we updated our app 5 days ago with removing viewwilltransition & uialertccontroller so that presentviewcontroller dont happen.
But this popped up first and only time now.
The code for GameCenter, we are using in our UIKit code is - https://github.com/fserrazes/GameCenterKit
Hi @JL_W were you able to resolve this, we have the exact same crashes and the only one's left in one of our app. Any help will be deeply appreciated. Thanks