Weird crash: missing symbol Swift.AsyncIteratorProtocol.next()

I got several reports about our TestFlight app crashing unconditionally on 2 devices (iOS 18.1 and iOS 18.3.1) on app start with the following reason:

Termination Reason: DYLD 4 Symbol missing Symbol not found: _$sScIsE4next7ElementQzSgyYa7FailureQzYKF (terminated at launch; ignore backtrace)

The symbol in question demangles to (extension in Swift):Swift.AsyncIteratorProtocol.next() async throws(A.Failure) -> A.Element?

Our deploy target is iOS 18.0, this symbol was introduced in Swift 6.0, we're using latest Xcode 16 now - everything should be working, but for some reason aren't.

Since this symbol is quite rarely used directly, I was able to pinpoint the exact place in code related to it. Few days ago I added the following code to our app library (details omitted):

public struct AsyncRecoveringStream<Base: AsyncSequence>: AsyncSequence {
    ...
    public struct AsyncIterator: AsyncIteratorProtocol {
        ...
        public mutating func next(isolation actor: isolated (any Actor)? = #isolation) async throws(Failure) -> Element? {
            ...
        }
    }
}

I tried to switch to Xcode 26 - it was still crashing on affected phone. Then I changed next(isolation:) to its older version, next():

public mutating func next() async throws(Failure) -> Element?

And there crashes are gone. However, this change is a somewhat problematic, since I either have to lower Swift version of our library from 6 to 5 and we loose concurrency checks and typed throws or I'm loosing tests due to Swift compiler crash. Performance is also affected, but it's not that critical for our case.

Why is this crash happening? How can I solve this problem or elegantly work around it?

Thank you!

Answered by DTS Engineer in 863311022

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

The only two devices that were crashing were 18.1 and 18.3.1

And 18.0 is your deployment target, right? So you don’t need to support iOS 17.

Given that, my inclination is to raise your deployment target to something later in the iOS 18.x range, so iOS 18.5, 18.6, or 18.7. Any device that can run iOS 18.0 can also run, say, 18.7, and so you’re not leaving anyone behind by raising your deployment target. And it has the added advantage that it encourages your users to update their devices, which is good because there have been a lot of import security fixes in the various iOS 18 software updates.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS 18.1 and iOS 18.3.1

Does this crash on all iOS 18.x variants? Or just these really old ones?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

The only two devices that were crashing were 18.1 and 18.3.1

And 18.0 is your deployment target, right? So you don’t need to support iOS 17.

Given that, my inclination is to raise your deployment target to something later in the iOS 18.x range, so iOS 18.5, 18.6, or 18.7. Any device that can run iOS 18.0 can also run, say, 18.7, and so you’re not leaving anyone behind by raising your deployment target. And it has the added advantage that it encourages your users to update their devices, which is good because there have been a lot of import security fixes in the various iOS 18 software updates.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Weird crash: missing symbol Swift.AsyncIteratorProtocol.next()
 
 
Q