johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
4.08k stars 319 forks source link

EXC_BAD_ACCESS after add var in swift class #479

Closed happy201993 closed 9 months ago

happy201993 commented 9 months ago

image

ViewController was coded by Objective-C, and create some AAATagItemModel and send to a swift view.

  1. quit current ViewController.
  2. add var title2: String = "" to this class, and i can see compile success in console
  3. app was crashed when i enter ViewController again image
johnno1962 commented 9 months ago

Hi, you won't be able to add properties or make changes to memory layout of a class instance over the course of an injection by adding a property. Did you not receive a warning on the console about this? This includes adding/renaming class methods as it changes the layout of the "vtable" used for member function dispatch.

happy201993 commented 9 months ago

Hi, you won't be able to add properties or make changes to memory layout of a class instance over the course of an injection by adding a property. Did you not receive a warning on the console about this? This includes adding/renaming class methods as it changes the layout of the "vtable" used for member function dispatch.

OK, Thanks!