
比如:
我现在有个Dog类
@implementation Dog - (instancetype)initWithName:(NSString *)name { if (self = [super init]) { _name = name; } return self; } 然后在ViewController里
@interface ViewController () @property (srong, nonatomic) Dog *dog; @end @implementation ViewController objection_requires(@"dog"); objection_initializer(initWithName:, @"Chuck") - (void)viewDidLoad { [super viewDidLoad]; JSObjectionInjector *injector = [JSObjection createInjector]; [injector injectDependencies:self]; NSLog(@"%@", self.dog); NSLog(@"%@", self.dog.name); } objection_requires(@"dog")是调用的dog的init方法。我现在想调用dog的initWithName。发觉objection_initializer(initWithName:, @"Chuck")根本没起作用呢。