Open
Description
Describe the bug
objc_getClassList
crash in the code below:
#if canImport(RoomPlan)
import RoomPlan
@available(iOS 16, *)
class Foo: NSObject {
var bar: CapturedRoom?
}
#endif
import SwiftUI
@main
struct MetadataAccessorCrashApp: App {
var body: some Scene {
WindowGroup {
Text("")
.onAppear {
// Crash here
let _ = objc_getClassList(nil, 0)
}
}
}
}
Steps To Reproduce
Steps to reproduce the behavior:
- Clone the repository https://github.com/kemchenj/TypeMetadataAccessorCrash
- Open
MetadataAccessorCrash.xcodeproj
project - Build and run on any iOS simulator or device that OS version lower than iOS 16 (e.g. iOS 15.5)
- App will crash when
objc_getClassList
was called
Expected behavior
Not crash.
Screenshots
Stacktrace:
Environment (please fill out the following information)
- OS: macOS
- Xcode 14.0
Additional context