Zuikyo / ZIKRouter

Interface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'The router (XMDModulesViewRouter) doesn't support makeDestination'

JanXu-Dev opened this issue · comments

请问一下这个具体是什么原因, 找了挺久的, 大神帮我看看
2018-09-27 22:38:54.110016+0800 iOS-More[56319:8936026] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The router (XMDModulesViewRouter) doesn't support makeDestination'
*** First throw call stack:
(
0 CoreFoundation 0x000000010abbf29b __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010a157735 objc_exception_throw + 48
2 CoreFoundation 0x000000010abbf022 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000109b5bb47 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 ZIKRouter 0x00000001099d27c6 +[ZIKRouter makeDestinationWithConfiguring:] + 694
5 ZIKRouter 0x0000000109a013f5 +[ZIKViewRouter makeDestinationWithConfiguring:] + 517

还有一个疑问: 界面路由 与 界面模块路由, 其实两者之间的区别, 除了模块解耦, 那项目中, 具体说如何选用, 打个比方, 一个 tarbar 可以说更对应一个 界面模块路由吧?

commented

你可以看看代码里 NSAssert 的提示,是由于 router 的+canMakeDestination返回 NO,说明不支持 make destination。一般就是 你的 view router 在重写 +supportedRouteTypes的时候没有加上ZIKViewRouteTypeMaskMakeDestination类型。

不好意思, 我刚找到, 我也是魔障了, 太不小心了, 刷新的时候, 作者大神已经恢复了, 尴尬~~

commented

界面路由是指 protocol 是被 destination 直接实现的。界面模块路由的 protocol 是被 router 的自定义 configuration 实现的。
在用 protocol 传递参数时,可能会有一些复杂的数据参数,这些参数不应该被 destination 接触到,例如 VIPER 中的 view 不应该接触到 model 参数,这时就可以用 module config protocol,先把参数放到 configuration 上,再在 router 内部把参数传给模块的其他组件,例如 把 model 传给 VIPER 中的 interactor。这样就能更好地进行隔离了。
当然如果要求没那么严格,只用界面路由也行。

嗯嗯, 谢谢, 这么晚还回复, 已解决.