问题
I'm developing an iOS framework and need to write a swizzling method (for viewDidAppear method in UIViewController).
My swizzling method works perfectly in my application. But when I cut/paste my header+implementation files to my framework and launch the app, it doesn't work. I put an NSLog
inside the load
method but it doesn't print anything.
For swizzling, I followed this tutorial: http://spin.atomicobject.com/2014/12/30/method-swizzling-objective-c/ I added my "UIViewController+Logging.h" inside the public headers.
Any idea why it doesn't work?
回答1:
Thats because your category is not loaded automatically when the app starts. See this question : Objective-C categories in static library
来源:https://stackoverflow.com/questions/32207470/swizzling-not-working-in-a-framework