Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVVM模块下,RACObserve(self.dataDriver, expressData)奔溃 #12

Open
iT-Boyer opened this issue Nov 19, 2020 · 8 comments
Open

MVVM模块下,RACObserve(self.dataDriver, expressData)奔溃 #12

iT-Boyer opened this issue Nov 19, 2020 · 8 comments

Comments

@iT-Boyer
Copy link

在mVVM模块下,bindViewData方法中,仅打开默认的绑定代码块RACObserve:

 XF_Define_Weak
    [RACObserve(self.dataDriver, expressData) subscribeNext:^(NSString *imgUrl) {
        XF_Define_Strong
        // 如果有显示数据加载完成
    }];

奔溃位置:

#15	0x00000001065d1b0c in -[RACKVOTrampoline initWithTarget:observer:keyPath:options:block:] at /Users/jhmac/hsg/SupervisionSel/Pods/ReactiveCocoa/ReactiveCocoa/RACKVOTrampoline.m:50
@yizzuide
Copy link
Owner

ReactiveCocoa版本是2.5.2吗

@iT-Boyer
Copy link
Author

iT-Boyer commented Nov 19, 2020

项目依赖:

pod 'ReactiveCocoa', '~> 2.5'

官网好像没有2.5.2版本

刚尝试了:

pod 'ReactiveCocoa', :git => 'https://github.com/zhao0/ReactiveCocoa.git', :tag => '2.5.2'

问题还存在。

@yizzuide
Copy link
Owner

我打开例子工程的XFAboutViewController里的这段注释,运行是正常的,我提交了,你可以拉下来运行看看

@iT-Boyer
Copy link
Author

iT-Boyer commented Dec 2, 2020

对比了差异:
我是用router注册方式,然后执行宏push:
这样就会导致issues描述的崩溃,想问下,mvvm模块不支持注册吗?

#1. 注册
 // 配置乐高框架 // 使有默认配置
    [[XFLegoConfig defaultConfig]
                    addComponentHanderPlug:[LEMVVMModuleHandler class]]; // 添加扩展MVVM模块组件处理器
 [XFURLRoute initURLGroup:@[
                                 @"rac://Login", // mvvm组件
                                 ]]; 
#2. push
XF_PUSH_Component_Fast(@"rac://Login")

项目XFAboutViewController的处理方式:

 XFAboutViewController *aboutVC = [[XFAboutViewController alloc] init];
//    [LEMVVMConnector makeComponentFromUInterface:aboutVC forName:@"about"];
    [LEMVVMConnector makeComponentFromUInterface:aboutVC forName:@"about" intentData:@{@"id":@(123)}];
    UINavigationController *nav = [[XFNavigationController alloc] initWithRootViewController:aboutVC];
    [self.realUInterface presentViewController:nav animated:YES completion:nil];

@yizzuide
Copy link
Owner

yizzuide commented Dec 3, 2020

例子中的用法是旧项目里从ViewController --跳转到--> MVVM组件,起到桥接旧项目的目的,你使用URL注册并执行宏push也是可以的,例子改了下,你下下来看看,没有问题的

@yizzuide
Copy link
Owner

yizzuide commented Dec 3, 2020

另外,MVVM组件不是必需继承LEViewController,可以通过实现协议的方式@interface XFAboutViewController : UIViewController <LEMVVMIntent>,内部会通过动态绑定实现组件化的

@iT-Boyer
Copy link
Author

iT-Boyer commented Dec 3, 2020

我fork项目,然后使用mvvm模块创建了一个模块:XFRAC,经过下面步骤,还是奔溃。

  1. 注册
 @"xf://search/XFRAC",
  1. 跳转
XF_Present_URLComponent_Fast(@"xf://search/XFRAC?nav=UI")

方便试一下吗?fork
test监听调用的XFRAC模块:
截屏2020-12-03 下午7 08 08

@yizzuide
Copy link
Owner

yizzuide commented Dec 4, 2020

将所类的前缀XFRAC 改为XFRac,另外XF_Present_URLComponent_Fast(@"xf://search/XFRAC?nav=UI")改为XF_Present_URLComponent_Fast(@"xf://search/rac?nav=UI")

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

No branches or pull requests

2 participants