AppShortcutsProvider triggered for unsupported OS

Hi!

I have an AppShortcutsProvider that has been marked @available(iOS 17.0, *), because all Intents used within it are only available in iOS 17. So the static var appShortcuts should only be accessible in iOS 17, obviously.

Now this code has been released and works fine for iOS 17 users. But I just noticed that around 150 iOS 16 users have crashed in the static var appShortcuts, or more specifically, the defaultQuery of one of the Intents. This should not be possible, as neither the AppShortcutsProvider, nor the Intent is exposed to iOS 16, they are marked as @available(iOS 17.0, *). Any idea why this could happen?

Here is the crash log:

Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x3e178c swift::ResolveAsSymbolicReference::operator()(swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)
1  libswiftCore.dylib             0x40bec4 swift::Demangle::__runtime::Demangler::demangleSymbolicReference(unsigned char)
2  libswiftCore.dylib             0x408254 swift::Demangle::__runtime::Demangler::demangleType(__swift::__runtime::llvm::StringRef, std::__1::function<swift::Demangle::__runtime::Node* (swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)>)
3  libswiftCore.dylib             0x3e9680 swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>)
4  libswiftCore.dylib             0x3e4d9c swift_getTypeByMangledName
5  libswiftCore.dylib             0x3e50ac swift_getTypeByMangledNameInContext
6  MyApp                           0x3f6b8c __swift_instantiateConcreteTypeFromMangledName (<compiler-generated>)
7  MyApp                           0x640e3c one-time initialization function for defaultQuery + 146 (IntentAction.swift:146)
8  libdispatch.dylib              0x3eac _dispatch_client_callout
9  libdispatch.dylib              0x56ec _dispatch_once_callout
10 MyApp                           0x64109c protocol witness for static AppEntity.defaultQuery.getter in conformance IntentAction + 124 (IntentAction.swift:124)
11 AppIntents                     0x15c760 _swift_stdlib_malloc_size
12 AppIntents                     0x19dfd4 __swift_destroy_boxed_opaque_existential_1Tm
13 MyApp                           0x52dadc specialized ActionIntent.init(action:) + 41 (ActionIntent.swift:41)
14 MyApp                           0x52df80 specialized static MyShortcuts.appShortcuts.getter + 17 (MyShortcuts.swift:17)

Replies

Did you ever solve this issue? In my testing the @available annotation for the AppShortCutsProvider is totally ignored. I have AppShortCuts appearing on IOS 16 that are only compatible with iOS 17 and also lead to crashes.

Reported as FB13711844