Skip to content

Conversation

@sheepy1
Copy link

@sheepy1 sheepy1 commented Jul 30, 2016

No description provided.

self.window.rootViewController = [[UIViewController alloc] init];
} else {
// 使用 storyboard 时,需要把 rootController 存下来,待修复完成后,重新设置 self.window.rootViewController
self.originalRootViewController = self.window.rootViewController;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样写有一个前提,rootViewController在初始化的时候不会crash

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你是说在 rootViewController 的 initWithCoder 里有崩溃的逻辑么,这种情况我暂时没找到解决的办法,因为这种情况在 didFinishLaunching 调用前就已经 crash 了……用这个库的思路(Method Swizzling 动态替换 didFinishLaunching 方法)解决不了这种问题。不过我觉得这种情况应该也很少发生,使用 sb 的话很少会去重写 rootViewController 的 initWithCoder 方法吧。可以在 README 中向使用者说明一下这种情况。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants