Post

Replies

Boosts

Views

Activity

Reply to iOS 15 crash with objc_getClass
The text version of the crash report should be attached. There are two relevant snippets of code for this crash to happen: @available(iOS 16.0, *) @MainActor final class ScanViewModel { var scanTextType: DataScannerViewController.TextContentType? @Published var recognizedItems: [RecognizedItem] = [] } In this block, we use the @available annotation to try and stop things that don't exist in iOS 15 from being accessed. Later, in instrumentation: unsigned int classNameCount = 0; const char **classNames = objc_copyClassNamesForImage(mainImageName, &classNameCount); for (NSUInteger i = 0; i < classNameCount; i++) { Class cls = objc_getClass(classNames[i]); NRMA__processClass(cls, results, parents); } free(classNames); This crashes on the call to objc_getClass() when passed the class which has the @available annotation. What I am asking is if there is a workaround for this bug in iOS 15 (this doesn't happen on iOS 16 and above)? Thank you. Crash15-2024-01-16-093511.txt
Jan ’24