ionic-team/capacitor

Crash while launching app: Swift class extensions and categories on Swift classes are not allowed to have +load methods (lldb)

Closed this issue · 10 comments

Description of the problem:
The application compiles successfully but does not start. On start up, throws error:
objc [1138]: Swift class extensions and categories on Swift classes are not allowed to have + load methods(Lldb).

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information:
Tested without any plugins or changes.

Capacitor version:
1.0.0-beta.17

node version:
11.9.0

npm version:
6.8.0

CocoaPods version:
1.6.0

Steps to reproduce:
Use latest Xcode 10.2 beta 3 (10P99q) and build any app. Use latest iOS 12.2 to test it.

This was fixed here #1242

I have replaced the contents of the CAPPluginCall.swift file with this pull request, which you sent and the error still occurs.

Have you done a product -> clean build folder before running? Xcode 10 doesn’t rebuild cocoa pods projects

Yes, I done it. Please test on XCode 10.2 beta 3

Sorry, you are right, this is a different issue

This crash is only happening when I deploy to a device with iOS 12.2. For an older phone or iOS 12.1 or lower, it won't crash. I'm getting this error below.

objc[1919]: Swift class extensions and categories on Swift classes are not allowed to have +load methods
Message from debugger: Terminated due to signal 9

Capacitor 1.0.0-beta.17

I have the same problem with vanillaJS and vueJS, so it's not connected with react-native.
Crash on 12.2-12.3, all works fine on 12.1 and lower.

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

Capacitor 1.0.0-beta.19

grgur commented

I can confirm this issue has been resolved with capacitor 1.0.0-beta.19.

make sure you have "@capacitor/ios": "^1.0.0-beta.19" in your package.json, not just the CLI 1.0.0-beta.19.
Then do npx cap update ios, npx cap open ios and finally Product -> Clean Build Folder on Xcode, as Xcode 10 doesn't rebuild the changes in CocoaPods libraries and the clean makes it build on next run.