Post

Replies

Boosts

Views

Activity

Segmentation fault vs Variable ... used before being initialized
We got a segmentation fault on our Testflight build (not on debug builds). The build was created with the latest xCode version, the code is written in Swift (SwiftUI). Luckily, one developer still uses an older version of xCode (12.4) and realised that the code doesn't compile for that version. We get a "Variable ... used before being initialized" compiler error. Turns out that fixing the compiler error also fixes the segmentation fault crash.     @Binding var playingId: Int?     @State var player: AVPlayer     init(playingId: Binding<Int?>,) {         self.player = AVPlayer()         self._playingId = playingId } changed to:     @Binding var playingId: Int?     @State var player: AVPlayer = AVPlayer()     init(playingId: Binding<Int?>,) {        self._playingId = playingId } So, I wonder where the problem lies: Is this a compiler bug in the newest version? A runtime problem? Or a problem in the language definition?
5
0
936
Aug ’21