Open sibljon opened 7 years ago
Can you remove the injected method or change it to a class method?
Can you remove the injected method or change it to a class method?
Both of these options work! Thanks! Do you know why? Ideally, I'd like to be able to use an instance injected()
method to do things like self.setNeedsLayout()
etc.
Instance level injected performs a sweep of al objects i your app which isn’t as reliable as it could be. If you patch the project you’ll be able to see where it crashes. You could also use the INJECTION_BUNDLE_NOTIFICATION.
Excellent, INJECTION_BUNDLE_NOTIFICATION
works. Thank you @johnno1962 for making this possible with this library and app!
Just want to report that I was seeing this as well and removing the instance method fixes it. In my case, cleaning the build also would fix the issue (until the next time I hit it), but that's not a very practical work around.
Unfortunately, using INJECTION_BUNDLE_NOTIFICATION isn't a great work around either because I prefer to implement injected on an extension to UIViewController rather than having to add it to every subclass. For now, my work around is to disable the injected instance method in my extension, recompile, then re-enable it and recompile again. This clears whatever bad state was causing the crash.
After injection (via the
Inject Source
menu item) on the iOS Simulator, my app immediate terminates with Xcode showing anEXC_BAD_ACCESS
on my Application Delegate.Any ideas as to what I might be doing wrong, or what I can try?
Looking through the GitHub Issues on this project, as well as that of the original injectionforxcode project, the only issue I see is that I may have more than 128 Swift files in my project. Is this still a limitation?
Besides that, we use non-compatible Swift features elsewhere like
final class
, but I've tried to limit the scope of my test to a single file,SimpleViewController.swift
:NOTE: I experienced the same issue in #2. I'm not sure whether these two issues have the same root cause or are related. I'm just mentioning that to give a more complete context.
Here's my full console log, for reference: