15

After updating Xcode to 10.2 beta 3, I receive this error while starting app, which will result in crash (app compiles successfully):

objc[2140]: Swift class extensions and categories on Swift classes are not allowed to have +load methods (lldb)

Do you know what this may be due to?

Cœur
  • 37,241
  • 25
  • 195
  • 267
blaxckv
  • 175
  • 1
  • 8
  • 1
    Seems that you're not the only one seeing the problem. https://github.com/pmusolino/Wormholy/issues/51 – SaganRitual Feb 24 '19 at 15:28
  • 1. Quick search for any function names `load` (or containing `load` in the name) and see if renaming solves the issue. 2. List your PodFile/CartFile and isolate the framework causing issue. 3. If everything fails, create a [mcve] and post it on GitHub or BitBucket. – Cœur Feb 25 '19 at 01:39
  • 1
    Same result with the new Xcode release. Did you find a way to detect which classes or extensions violates this new convention? Getting the same result but with no hints at all. – Thomas G. Mar 29 '19 at 09:12
  • @ThomasG. Did you find something in the meantime? – manmal Apr 10 '19 at 08:26

2 Answers2

4

In my case, it is because I added a module which uses Swift to my ReactNative project. In this issue they discussed this bug and there were several solutions.

The official solution is to upgrade RN to 0.59.3+, but it may influence too much for me and I would not to do that for now, so I edited RCTBridgeModule.h according to this commit as a workaround and it works.

wkm
  • 347
  • 3
  • 6
3

Some of your dependencies can have +load methods. In my case, there were Firebase and Swinject cocoapods.

mbabaev
  • 353
  • 2
  • 6