私は手動でInitial viewControllersをインスタンス化しようとしていて、次のことで立ち往生しています。
これは機能しています:
-(TyphoonStoryboard *)storyboard {
return [TyphoonDefinition withClass:[TyphoonStoryboard class] configuration:^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:@"Diary"];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
-(LADiaryMainViewController *)mainViewController {
return [TyphoonDefinition withFactory:[self storyboard] selector:@selector(instantiateInitialViewController)];
}
これは機能していません:
-(TyphoonStoryboard *)storyboardWithName:(NSString *)name {
return [TyphoonDefinition withClass:[TyphoonStoryboard class] configuration:^(TyphoonDefinition* definition) {
[definition useInitializer:@selector(storyboardWithName:factory:bundle:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:name];
[initializer injectParameterWith:self];
[initializer injectParameterWith:[NSBundle mainBundle]];
}];
}];
}
-(LADiaryMainViewController *)mainViewController {
return [TyphoonDefinition withFactory:[self storyboardWithName:@"Diary"] selector:@selector(instantiateInitialViewController)];
}
2 番目の方法は次のようなクラッシュです。[__NSArrayM insertObject:atIndex:]: object cannot be nil