Test flight app crashes with libAVFAudio.dylib: AVAE_RaiseException(NSString*, ...) + 60 - ios

I uploaded an archive on app store and am getting crash when I 'm trying to play an intro sound. I'm using AVAudioEngine to play the sound. When I compile and run code through Xcode everything works fine. When I upload on TestFlight and try to run my app as an internal tester my app crashes. The crash report is:
If I use AVAudioPlayer to play that sound it's ok. I can't understand what is the problem with AVAudioEngine. Any advices?

I faced the same exception only in the release build of my app and specific to iPhone7.
The exception seems to occur at a changing point of audio session category.
In my case, changing from
AVAudioSessionCategorySoloAmbient
to
AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.defaultToSpeaker
I found a workaround which works at least just for me.
The following article
https://forums.developer.apple.com/thread/65656
tells that this kind of exception occurs at initialization of multiple input audio unit.
In order to prevent initialization of multiple input audio unit,
I added the following codes before the change of audio session category
AudioOutputUnitStop((engine.inputNode?.audioUnit)!)
AudioUnitUninitialize((engine.inputNode?.audioUnit)!)
engine is the instance of AVAudioEngine.
I hope it will help you guys!

Related

iOS 11/12 Core Audio - Crackling / Popping Audio

My configuration
iPhone X
iOS 12
Problem
Since iOS 11/12 my apps audio for some reason has a periodic crackling/popping sound which appears to get worse/more noticeable the louder or more constant the audio is.
Troubleshooting
I played a 800Hz sine wave from djay2 through AudioBus into my app and saved the output of my app to a file.
Loading my apps output into Audacity I can see that the crackling occurs every 14,112 samples or every 0.320 seconds.
Has anyone got any idea where I should start looking. Changing the internal configuration of my app between 41.1kHz and 48kHz appears to make no difference. I thought it might have been due to downsampling from the hardware sample rate.
Toggling Inter-App Audio Sync on/off within AudioBus appears to have some effect (1 in every ~8 toggles will stop the crackling).
I assume this is due to the AudioSession being restarted or something.
Has anyone got any idea what might be causing this or has experienced this before?
Thanks,
Anthony

MPRemoteCommandCenter and Play Pause Update with the AVSpeechSynthesizer

I am currently using AVSpeechSynthesizer for Text to Speech. Category used for the playback is AVAudioSessionCategoryPlayback and AVAudioSession is set to Active YES.
During the start of the play, [TTS] TTSPlaybackCreate unable to initialize dynamics: -3000 in the Xcode console. When i pause the playback i get [TTS] _BeginSpeaking: couldn't begin playback.
My major issue is MPRemoteCommandCenter doesn't get updated to pause when TTS stopped.
For Stop functionality, I am using this code;
BOOL speechStopped = [self.ttsSpeechSynthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate];
if(!speechStopped) {
[self.ttsSpeechSynthesizer stopSpeakingAtBoundary:AVSpeechBoundaryWord];
}
I had Airplay connected to an Airplay station.
I had a similar issue after updating iOS to the latest version on my phone.
I spent much time trying to understand why my app stopped talking using TextToSpeech while all worked before and code seemed ok.
Siri was talking aloud fine, and the sound in other apps worked as well
Mine was giving no error message in the code and the following in the device log:
Error (730) / LearnByHeart.iOS(TTSSpeechBundle): TTSPlaybackCreate unable to initialize dynamics: -3000
Rebooting the phone did not help.
As funny as it is, all got resolved by turning the physical sound button off and back on.
Hope this saves someone a day

AVPlayer causes Simulator to crash but runs fine on device

I've searched all the Internet around, but found no mentions of this error.
I am using AVPlayer to play stream audio from remote or local URL.
However, while on my device it works fine, on simulator it is crashing.
I've found out that creation of player is going fine, but as soon as I call [playerInstance play] the app crashes.
The error is occurring somewhere in CommonURLAssetNotificationQueue.
And the exception breakpoint points me to 0x10e8a2519: pushq %rbp, which is not helpful at all.
However, on device it works fine.
So, is it my mistake and I have to fix the code? Or it's just simulator acting wonky?
It is likely that you have an exception breakpoint enabled. The play method in AVPlayer normally throws an exception, even though nothing is wrong. The exception doesn't crash the app, and the app then continues to run exactly as you wanted it to. If you have exception breakpoints enabled, however, Xcode notices the exception and crashes the app. If you go into the left sidebar and disable your exception breakpoint the app will run without crashing.
Change exception all as Objective C.
My resolving method is to add 'usage description' in App's Info page. Because the AVPlayer Demo App is trying to use local photo library without asking permission, this causes the demo app to crash. After adding the 'Privacy — Photo Library Usage Description', I can run this demo app successfully.

Ignore missing audio device in XNA

When I try to run an XNA application on a windows 7 machine that has an audio device, but it doesn't have any speakers plugged in, I get the following error message:
Could not find a suitable audio device. Verify that a sound card is
installed, and check the driver properties to make sure it is not
disabled
Is there a way to catch this error an ignore it. I don't really care if the player has any sound or not, the game should still run in this case.
Same answer as here: In theory it should throw a NoAudioHardwareException.
So try doing something with audio (SoundEffect.MasterVolume comes to mind as a possibility, as it is a static method) and see if you can catch the exception. If you do catch an exception, simply do no further audio work.

AudioQueueDispose crashes in IOS 6, works fine in IOS 5

I'm streaming music from SoundCloud, using their streaming APIs, which in turn uses Apple's AudioToolbox framework. You can find the git repository here.
The app was streaming fine using ios 5 and below. Now with ios 6 I'm getting EXC_BAD_ACCESS anytime an AudioQueue is disposed via AudioQueueDispose. I've tried commenting out this line; sure enough it doesn't crash anymore, but obviously my audio streams keep playing and never get dealloc'd.
I'm not really sure what could be causing this. Is this a bug that needs to be reported with Apple? Or some new feature in ios 6 that inadvertently causes the audioQueue to be referenced somewhere after it has been disposed? Has anyone noticed behavior like this?
AudioQueueDispose will work in iOS6 devices without fail. You have to pass true as second parameter for AudioQueueDispose. Then its asynchronously stop the queue. But the problem is same thing is not working in iOS 6.1 devices. Can anybody help me for this issue.Thanks for advance.

Resources