Skip to content

Conversation

dkimitsa
Copy link
Contributor

@dkimitsa dkimitsa commented Jun 7, 2021

report on gitter

There is a bug observed in iOS12 that causes not all Objective-C class fields properly initialized
in Class instance of Swift classes. This causes a crash in APIs like class_copyProtocolList to crash
as it faces not initialized data. Example of such class is Swift.__EmptyDictionarySingleton.
Workaround for this case is to call [NSObject class] selector that initializes all structs.
ObjCClass is not always NSObject check for responds to selector is required here.
similar case: dotnet/macios#6293

…copyProtocolList

There is a bug observed in iOS12 that causes not all Objective-C class fields properly initialized
in Class instance of Swift classes. This causes a crash in APIs like class_copyProtocolList to crash
as it faces not initialized data. Example of such class is `Swift.__EmptyDictionarySingleton`.
Workaround for this case is to call [NSObject class] selector that initializes all structs.
ObjCClass is not always NSObject check for responds to selector is required here.
similar case: dotnet/macios#6293
@dkimitsa
Copy link
Contributor Author

dkimitsa commented Jun 7, 2021

long read

@Tom-Ski Tom-Ski merged commit e317035 into MobiVM:master Oct 19, 2021
@dkimitsa dkimitsa deleted the fix/objc_runtime_class_info_workaround branch October 20, 2021 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants