App created by Xcode 13.3+ crash on iOS 12 physical devices at launch

When I create a build using Xcode 13.3 or 13.4, the app crash on iOS 12 physical devices at launch. My current workaround is to use Xcode 13.2.1 instead which the app will run without crash. But, I believe that is not a permanent solution. The crash message:

dyld: Symbol not found: _OBJC_CLASS_$_HKElectrocardiogramQuery
2  Referenced from: /var/containers/Bundle/Application/C6835A53-158A-4A7A-8517-7E7824D1A334/MyApp Debug.app/MyApp Debug
3  Expected in: /System/Library/Frameworks/HealthKit.framework/HealthKit
4 in /var/containers/Bundle/Application/C6835A53-158A-4A7A-8517-7E7824D1A334/MyApp Debug.app/MyApp Debug

Does anyone know how to fix the issue? Will Apple address the issue for the upcoming Xcode update?

Post not yet marked as solved Up vote post of RH00 Down vote post of RH00
292 views

Replies

  • Your target sets a higher deployment OS
  • Some SDK (in HealthKit, in your case)for iOS 12 was not in use anymore so Xcode got confused

I'm also new
just suggesting some possibilities
Hope it'll help

HKElectrocardiogramQuery is only available on iOS14.0 (https://developer.apple.com/documentation/healthkit/hkelectrocardiogramquery?language=objc) So its usage on an iOS 12.0 device will cause crashes. If you want to support iOS 12.0 devices, you'd have to set the minimum iOS version in the build settings under iOS Deployment Target. And if your app uses API that were introduced in iOS versions > 12.0 then you need to add availability checks in your code.

  • The main issue here is that I already guard HKElectrocardiogramQuery by the #available(iOS 14.0, *), otherwise, the project cannot be compiled.

Add a Comment