From 13c06ca2d2239cf3df7854b4fa6be608a4cd59e5 Mon Sep 17 00:00:00 2001 From: Tanner Bennett Date: Sat, 30 Apr 2022 21:16:33 -0500 Subject: [PATCH] Remove a fatalError in ConformanceDescriptor A conformance's class will be nil when the conformance refers to a class that is only present in a newer SDK. For example, SDKAdImpression is only available on iOS 14.5. An app that uses SDKAdImpression would wrap it in `if @available` guards. While the conformance and class name is still present in the binary when it runs on iOS < 14.5, the class will be `nil`. --- Sources/Echo/Runtime/ConformanceDescriptor.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Echo/Runtime/ConformanceDescriptor.swift b/Sources/Echo/Runtime/ConformanceDescriptor.swift index 33760e8..a06aad6 100644 --- a/Sources/Echo/Runtime/ConformanceDescriptor.swift +++ b/Sources/Echo/Runtime/ConformanceDescriptor.swift @@ -64,7 +64,9 @@ public struct ConformanceDescriptor: LayoutWrapper { .assumingMemoryBound(to: CChar.self) guard let anyClass = objc_lookUpClass(ptr) else { - fatalError("No Objective-C class named \(ptr.string)") + // A conformance with a nil class means the class was weak-linked + // from a newer SDK and isn't available in this version of iOS + return nil } return reflect(anyClass) as? ObjCClassWrapperMetadata