App crashes when playing audio on iOS13.1
Change this:
var backgroundMusicPlayer = AVAudioPlayer()
To this:
var backgroundMusicPlayer : AVAudioPlayer!
iOS 13.1 Crash in AVAudio Player
I found a crash issue in AVAudioPlayer
with iOS 13.1.
Here Is Solution
Why My AVAudioPlayer
crash? because
I initialise AVAudioPlayer
like
var wrongMusicPlayer: AVAudioPlayer = AVAudioPlayer()
and then i try to reassign wrongMusicPlayer
as below
wrongMusicPlayer = try AVAudioPlayer(contentsOf: wrongURL)
And my app get crash.
Solution
If you initialise your AVAudioPlayer
like var wrongMusicPlayer: AVAudioPlayer = AVAudioPlayer()
OR wrongMusicPlayer = AVAudioPlayer()
in any method then please remove it and just Declare like var wrongMusicPlayer: AVAudioPlayer!
.
Re-Assigning instance of AVAudioPlayer in iOS13 leads to BAD_ACCESS runtime error
Just remove the initialisation and it will work
private var mySoundPlayer: AVAudioPlayer!
Cheers!!!
CarPlay app using CarPlay framework crashes on iOS 13 or older version
You need to weakly link the CarPlay framework. In your target's Build Phases go the the Link Binary With Libraries section and check if CarPlay is already there (add it if not). Then make sure the Status is set to Optional
Related Topics
Why Can't I Divide Integers in Swift
Can You Give Uistackview Borders
Convert Opengl Shader to Metal (Swift) to Be Used in Cifilter
Evaluate Bool Property of Optional Object in If Statement
Convert Firdatasnapshot to Custom Type
Getting Path for Resource in Command Line Tool
Error: Unable to Spawn Process (Argument List Too Long) in Xcode Build
Checking When a Date Has Passed - Swift
Where Is the .Camera Anchorentity Located
Can Swift Playgrounds See Other Source Files in the Same Project
Swift Anyobject Is Not Convertible to String/Int
How to Convert Delegate to Observable Rxswift
How to Get Date and Time to Show a Clock in Uilabel
Convert Float Value to String in Swift
Using Swift to Disable Sleep/Screen Saver for Osx