I have updated Xcode Version 10.2 (10E125) and testing on devices (not only simulator)
I get this message when I execute the app:
objc[3297]: Swift class extensions and categories on Swift classes are not allowed to have +load methods
-I'm using extensions of swift classes but I don't think that is the problem
Using Cocoapods and Firebase dependencies.
I searched in my project any functions that could contain "load" functions, none found.
Please some help
Just to add a solution for React Native projects.
This issue occurred because one of our custom react native modules was using the RCT_EXPORT_MODULE()
macro which calls the init
function and we were also including swift code. Since react-native version 0.59.3, there's a new macro RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name)
which avoids the call to init
. Replacing RCT_EXPORT_MODULE()
with RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name)
and updating to react native version 0.59.3 fixed the issue.
In my case the only one dependency that has +load method is RxAtomic. Which, by the way, is the only one that didn't update to the current moment to swift 5.0. So I suppose this bug caused by RxSwift. And I also have Swinjects dependencies, but updated all to the newest releases that support swift 5 - it didn't help.
EDIT
I just open Pods project file. Select RxAtomic Target. And change User-Defined property 'SWIFT_VERSION' from 5.0 to 4.2. And it works!!!
At the moment the quick fix:
Once you've done that, rebuild your project and it works just fine on any device.
I think the problem is related to Swift 5. What we would probably need to do is update all the dependencies to Swift 5. At the moment I don't have the time to do so.
The long fix: Is update your pods and slowly migrate toward swift5.
The pod that was giving more problems was: Swinject with SwinjectStoryboard, and RxOptional.
upgrade to react-native version ^0.59.5
solved it without RCT_EXPORT_MODULE_NO_LOAD
,
to update react-native version,
rm -rf node_modules
yarn add react-native@^0.59.5
so this will update other dependancies packages with the new version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With