I'm getting a crash on iOS 14.2.0 when app tries to access a @TaskLocal
variable:
public class Clock {
@TaskLocal
public static var current: Clock = SystemClock()
public var now: Date {
fatalError("Abstract")
}
}
private final class SystemClock: Clock {
override var now: Date { Date() }
}
Crashed: com.apple.root.default-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
0 libswiftCore.dylib 0x38d508 swift::ResolveAsSymbolicReference::operator()(swift::Demangle::SymbolicReferenceKind, swift::Demangle::Directness, int, void const*) + 120
1 libswiftCore.dylib 0x3a7f8c swift::Demangle::Demangler::demangleSymbolicReference(unsigned char) + 208
2 libswiftCore.dylib 0x3a4e1c swift::Demangle::Demangler::demangleType(llvm::StringRef, std::__1::function<swift::Demangle::Node* (swift::Demangle::SymbolicReferenceKind, swift::Demangle::Directness, int, void const*)>) + 200
3 libswiftCore.dylib 0x392db8 swift_getTypeByMangledNameImpl(swift::MetadataRequest, 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)>) + 480
4 libswiftCore.dylib 0x39040c swift::swift_getTypeByMangledName(swift::MetadataRequest, 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)>) + 604
5 libswiftCore.dylib 0x390648 swift_getTypeByMangledNameInContext + 148
6 Booking.com 0x7d5868 __swift_instantiateConcreteTypeFromMangledName
7 libdispatch.dylib 0x3db0 _dispatch_client_callout + 20
8 libdispatch.dylib 0x55c8 _dispatch_once_callout + 32
9 libswiftCore.dylib 0x399604 swift_once + 48
10 MyApp 0x351fd58 static Clock.current.getter
Built using Xcode 14.2 with deployment target set to iOS 14.1.
Is TaskLocal
unavailable on iOS 14.2? I'm not getting any availability errors or warnigns when building the app.