-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use constructor attribute instead of +load objc method (#24155)
Summary: Xcode 10.2 forbids creating categories for swift class that uses `+load` method. In react-native categories like this are used to register swift classes as modules (macro `RCT_EXTERN_MODULE`) This PR changes it to use `__attribute__((constructor))` instead of objc `+load` method. I introduced new macro for this purpose, `RCT_EXPORT_MODULE_NO_LOAD`, it expands in something like: ``` void RCTRegisterModule(Class); + (NSString *)moduleName { return @"jsNameFoo"; } __attribute__((constructor)) static void initialize_ObjcClassFoo{ RCTRegisterModule([ObjcClassFoo class]); } ``` Functions marked with `__attribute__((constructor))` are run before main and after all `+load` methods, so it seems like correct thing to do. Fixes #24139 Doc about loading order https://developer.apple.com/documentation/objectivec/nsobject/1418815-load?language=objc [iOS] [Fixed] - Fix runtime crash in xcode 10.2 when using RCT_EXTERN_MODULE for swift classes. Pull Request resolved: #24155 Reviewed By: javache Differential Revision: D14668235 Pulled By: shergin fbshipit-source-id: 0c19e69ce2a68327387809773848d4ecd36d7461
- v0.78.0
- v0.78.0-rc.5
- v0.78.0-rc.4
- v0.78.0-rc.3
- v0.78.0-rc.2
- v0.78.0-rc.1
- v0.78.0-rc.0
- v0.77.1
- v0.77.0
- v0.77.0-rc.7
- v0.77.0-rc.6
- v0.77.0-rc.5
- v0.77.0-rc.4
- v0.77.0-rc.3
- v0.77.0-rc.2
- v0.77.0-rc.1
- v0.77.0-rc.0
- v0.76.7
- v0.76.6
- v0.76.5
- v0.76.4
- v0.76.3
- v0.76.2
- v0.76.1
- v0.76.0
- v0.76.0-rc.6
- v0.76.0-rc.5
- v0.76.0-rc.4
- v0.76.0-rc.3
- v0.76.0-rc.2
- v0.76.0-rc.1
- v0.76.0-rc.0
- v0.75.5
- v0.75.4
- v0.75.3
- v0.75.2
- v0.75.1
- v0.75.0
- v0.75.0-rc.7
- v0.75.0-rc.6
- v0.75.0-rc.5
- v0.75.0-rc.4
- v0.75.0-rc.3
- v0.75.0-rc.2
- v0.75.0-rc.1
- v0.75.0-rc.0
- v0.74.7
- v0.74.6
- v0.74.5
- v0.74.4
- v0.74.3
- v0.74.2
- v0.74.1
- v0.74.1-rc.0
- v0.74.0
- v0.74.0-rc.9
- v0.74.0-rc.8
- v0.74.0-rc.7
- v0.74.0-rc.6
- v0.74.0-rc.5
- v0.74.0-rc.4
- v0.74.0-rc.3
- v0.74.0-rc.2
- v0.74.0-rc.1
- v0.74.0-rc.0
- v0.73.11
- v0.73.10
- v0.73.9
- v0.73.8
- v0.73.7
- v0.73.6
- v0.73.5
- v0.73.4
- v0.73.3
- v0.73.2
- v0.73.1
- v0.73.0
- v0.73.0-rc.8
- v0.73.0-rc.7
- v0.73.0-rc.6
- v0.73.0-rc.5
- v0.73.0-rc.4
- v0.73.0-rc.3
- v0.73.0-rc.2
- v0.73.0-rc.1
- v0.73.0-rc.0
- v0.72.17
- v0.72.16
- v0.72.15
- v0.72.14
- v0.72.13
- v0.72.12
- v0.72.11
- v0.72.10
- v0.72.9
- v0.72.8
- v0.72.7
- v0.72.6
- v0.72.5
- v0.72.4
- v0.72.3
- v0.72.2
- v0.72.1
- v0.72.0
- v0.72.0-rc.6
- v0.72.0-rc.5
- v0.72.0-rc.4
- v0.72.0-rc.3
- v0.72.0-rc.2
- v0.72.0-rc.1
- v0.72.0-rc.0
- v0.71.19
- v0.71.18
- v0.71.17
- v0.71.16
- v0.71.15
- v0.71.14
- v0.71.13
- v0.71.12
- v0.71.11
- v0.71.10
- v0.71.9
- v0.71.8
- v0.71.7
- v0.71.6
- v0.71.5
- v0.71.4
- v0.71.3
- v0.71.2
- v0.71.1
- v0.71.0
- v0.71.0-rc.6
- v0.71.0-rc.5
- v0.71.0-rc.4
- v0.71.0-rc.3
- v0.71.0-rc.2
- v0.71.0-rc.1
- v0.71.0-rc.0
- v0.70.15
- v0.70.14
- v0.70.13
- v0.70.12
- v0.70.11
- v0.70.10
- v0.70.9
- v0.70.8
- v0.70.7
- v0.70.6
- v0.70.5
- v0.70.4
- v0.70.3
- v0.70.2
- v0.70.1
- v0.70.0
- v0.70.0-rc.4
- v0.70.0-rc.3
- v0.70.0-rc.2
- v0.70.0-rc.1
- v0.70.0-rc.0
- v0.69.12
- v0.69.11
- v0.69.10
- v0.69.9
- v0.69.8
- v0.69.7
- v0.69.6
- v0.69.5
- v0.69.4
- v0.69.3
- v0.69.2
- v0.69.1
- v0.69.0
- v0.69.0-rc.6
- v0.69.0-rc.5
- v0.69.0-rc.4
- v0.69.0-rc.3
- v0.69.0-rc.2
- v0.69.0-rc.1
- v0.69.0-rc.0
- v0.68.7
- v0.68.6
- v0.68.5
- v0.68.4
- v0.68.3
- v0.68.2
- v0.68.1
- v0.68.0
- v0.68.0-rc.4
- v0.68.0-rc.3
- v0.68.0-rc.2
- v0.68.0-rc.1
- v0.68.0-rc.0
- v0.67.5
- v0.67.4
- v0.67.3
- v0.67.2
- v0.67.1
- v0.67.0
- v0.67.0-rc.6
- v0.67.0-rc.5
- v0.67.0-rc.4
- v0.67.0-rc.3
- v0.67.0-rc.2
- v0.67.0-rc.1
- v0.67.0-rc.0
- v0.66.5
- v0.66.4
- v0.66.3
- v0.66.2
- v0.66.1
- v0.66.0
- v0.66.0-rc.4
- v0.66.0-rc.3
- v0.66.0-rc.2
- v0.66.0-rc.1
- v0.66.0-rc.0
- v0.65.3
- v0.65.2
- v0.65.1
- v0.65.0
- v0.65.0-rc.4
- v0.65.0-rc.3
- v0.65.0-rc.2
- v0.65.0-rc.1
- v0.65.0-rc.0
- v0.64.4
- v0.64.3
- v0.64.2
- v0.64.1
- v0.64.0
- v0.64.0-rc.4
- v0.64.0-rc.3
- v0.64.0-rc.2
- v0.64.0-rc.1
- v0.64.0-rc.0
- v0.63.5
- v0.63.4
- v0.63.3
- v0.63.2
- v0.63.1
- v0.63.0
- v0.63.0-rc.1
- v0.63.0-rc.0
- v0.62.3
- v0.62.2
- v0.62.1
- v0.62.0
- v0.62.0-rc.5
- v0.62.0-rc.4
- v0.62.0-rc.3
- v0.62.0-rc.2
- v0.62.0-rc.1
- v0.62.0-rc.0
- v0.61.5
- v0.61.4
- v0.61.3
- v0.61.2
- v0.61.1
- v0.61.0
- v0.61.0-rc.3
- v0.61.0-rc.2
- v0.61.0-rc.0
- v0.60.6
- v0.60.5
- v0.60.4
- v0.60.3
- v0.60.2
- v0.60.1
- v0.60.0
- v0.60.0-rc.3
- v0.60.0-rc.2
- v0.60.0-rc.1
- v0.60.0-rc.0
- latest
- 0.60.2
1 parent
46944b7
commit ff66600
Showing
1 changed file
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters