ionic-team / capacitor-docs

https://capacitorjs.com/docs
Apache License 2.0
20 stars 195 forks source link

docs: Update custom code information for Capacitor 6 #302

Closed jcesarmobile closed 2 months ago

jcesarmobile commented 2 months ago

The Objective-C class is no longer needed. A custom ViewController is needed and call to registerPluginInstance.

closes https://github.com/ionic-team/capacitor-docs/issues/275

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
capacitor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 17, 2024 3:17pm
tafelnl commented 2 months ago

This should definitely be in the migration guide! If you already have a custom plugin, you would want to know this.

Also, why has this been changed? Seems like a step back?

Steven0351 commented 2 months ago

Also, why has this been changed? Seems like a step back?

If you're referring to there no longer being automatic plugin registration, it's because it relied on the objective-c runtime to iterate all the classes it could see and attempt to initialize them. Unfortunately this method of initializing plugins can cause crashes in specific situations. The new method is more in line with how custom native code is added to Android.

tafelnl commented 2 months ago

Ahh, makes sense. Thanks for clarifying! Should I create an issue to get this info into the migration guide?