Async Await crash on iOS14 with Xcode 13.2.1

Using SwiftUI in XCode 13.2.1 triggers the inclusion of the Concurrency compatibility libraries in your app even if you use no concurrency anywhere in your own code.

1 Like

This is odd. We are using Bitcode and have SwiftUI in part of the app and Xcode 13.2.1 on the CI agents and the apps have been tested on iOS 14 without crashes… :/…

1 Like

Note that the crash is experienced on device only

1 Like

We are checking on real devices using TestFlight builds in iOS14 and iOS 15 devices (iOS 13 being set as min deployment SDK). Will run another test as we have bitcode and non bitcode enabled apps too and I wonder if that could affect things.

@Panajev Try this step and it most probably will crash if you are using Xcode 13.2.1.

  • Run your app (debug build) from Xcode to your device.
  • Stop the application.
  • Launch the app from Home Screen (don't run from Xcode second time).
  • It should crash now.

In my testing this is the workflow that crashes. Any archived build such as Adhoc and Test Flight are working fine.

Jay Muthialu

3 Likes

This is odd, as rearranging the SwiftUI code (essentially the workaround posted in the dev forums link from my original post) led the crash not to happen. We tested archived release builds, non-archived release builds, and non-archived debug builds. It is currently on the App Store with no reported crashes. So it’s not just using SwiftUI which causes the crash I posted. Therefore I now think this thread is actually about a slightly different issue than the one I linked.

1 Like

Hello,

A new Xcode beta is out, but the release notes do not say anything about fixing this crash.
@Douglas_Gregor is a fix for this bug included in this release? If not, then will it be included in the next beta of Xcode 13.3?

Thanks

Looks like it's included:

before:

% file /Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib
/Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib: Mach-O universal binary with 2 architectures: [arm64:Mach-O 64-bit dynamically linked shared library arm64] [arm64e]
/Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib (for architecture arm64):   Mach-O 64-bit dynamically linked shared library arm64
/Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib (for architecture arm64e):  Mach-O 64-bit dynamically linked shared library arm64e

after:

% file /Applications/Xcode-13.3.0-beta1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib
/Applications/Xcode-13.3.0-beta1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/iphoneos/libswift_Concurrency.dylib: Mach-O 64-bit dynamically linked shared library arm64

Yes, this issue is fixed in Xcode 13.3 beta 1. The back-deployment shared libraries (lib/swift-5.5/<platform>/libswift_Concurrency.dylib) are also compatible with Xcode 13.2 because there were no compiler changes that affected back-deployment here.

Doug

4 Likes

The back-deployment shared libraries ( lib/swift-5.5/<platform>/libswift_Concurrency.dylib ) are also compatible with Xcode 13.2 because there were no compiler changes that affected back-deployment here.

Does that also mean that just installing the Xcode 13.3 beta and then building & running the app on Xcode 13.2 will not crash the app?

No, you need the appropriate libswift_Concurrency.dylib binary from Xcode 13.3 beta in your app.

Doug

That is, what are the possible solutions to this problem now? We recently updated our app by building with Xcode 13.2.1 and are seeing a 400% increase in crashes in AppStoreConnect analytics.

Or will we still have to wait for the release version of Xcode 13.3?

Thanks.

You can either downgrade Xcode, or use the script provided above Async Await crash on iOS14 with Xcode 13.2.1 - #45 by zavsby

Note that on older devices it will crash 100% of the time

1 Like

@Keith thanks for the response.

Yes, I am talking about old devices. We support iOS 11+.

Are there any solutions to fix this right now? Or the only option is to wait for Xcode 13.3 GM? We have a broken app in the App Store, so the prospect of waiting is not encouraging... Thousands of crashes daily.

Only the 2 I mentioned above, but considering it crashes for all users on old devices I would suggest doing one of them and not waiting for Xcode 13.3

1 Like

@Keith

Could you please tell where exactly to insert this script? I'm sorry, but just don't have experience with this.

And then just archive and send to the App Store?

... or tweak the script to copy the shared libraries from the Xcode 13.3 beta into your app. No need to do any of the extra lipo work.

Doug

1 Like

It's a "post action script" in your scheme settings, here's an example screenshot from an older Xcode, that still shows the right place bash - Xcode doesn't seem to execute my scheme's post-action - Stack Overflow

I would say the easiest way if you don't want to get into this is to downgrade Xcode in the meantime though.

1 Like

@Keith

Thanks a lot!

Which version should I switch to to get rid of all these problems with Concurrency? 13.1? 13.0? It is broken since 13.2 right?

Correct, 13.0 or 13.1 would be fine

1 Like