BeeHive
BeeHive copied to clipboard
:honeybee: BeeHive is a solution for iOS Application module programs, it absorbed the Spring Framework API service concept to avoid coupling between modules.
过滤canOpenUrl为`/`的`pathComponentKey`
BHRouter 调用`canOpenURL` 时,使用`URL.pathComponents`获得的`pathComponents`会存在`/`,直接导致校验`pathComponentKey`是否为Class时,提前退出。 判断代码,当`pathComponentKey`为`/`会报错。 ``` Class mClass = NSClassFromString(pathComponentKey); if (!mClass) { flag = NO; *stop = NO; return; } ``` 建议添加一行过滤代码 ``` if ([pathComponentKey isEqualToString:@"/"]) { return; } ```
1、打开Xcode Address Sanitizer 2、运行项目 3、定位到问题,BHAnnoatation.m -> char *string = (char*)memory[idx];这一行代码。
我看demo中都是一个VC对应一个Protocol,是不是不支持一个protocol 对应多个VC。
https://github.com/alibaba/BeeHive/blob/ff7aef5707481606c6d107cd00840728bb78075a/BeeHive/BHRouter.m#L401-L407 `finalParams`为了初始化vc的属性,所以` [obj setObject:obj forKey:finalParams]; `应该改成如下 ```objc [finalParams enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, id _Nonnull val, BOOL * _Nonnull stop) { [obj setValue:val forKey:key]; }]; ```
系统modDidCustomEvent 事件
仅仅就用接口做了一次解耦。
你好,*BHAppDelegate*类`application:didFinishLaunchingWithOptions`方法会trigger `BHMSetupEvent` ` BHMInitEvent` `BHMSplashEvent`,为何没有如 **BHMDidFinishLaunchingEvent** 事件呢?其他代理方法的事件都有,如 * BHMWillResignActiveEvent * BHMDidEnterBackgroundEvent * BHMWillEnterForegroundEvent ... 是基于什么问题考虑的吗?
如果某个service的提供方的接口返回数据是block形式返回的,比如: ```objc // ShopModuleService.m - (void)fetchDataWithCompletion:(void (^)(NSData *))completion ``` 这时很有可能completion返回的时候ShopModuleService已经被释放了,所以这个时候必须要在ShopModuleService这么设置吗: ```objc + (BOOL)singleton { return YES; } + (id)shareInstance { return [self new]; } ``` 也就是说为了等一个completion返回(也许这个接口只调用一次)就必须让ShopModuleService的对象一直存在,一直不释放? 请问是这样的理解的吗,或者说这个问题可以有其他的解决办法?期待回复,谢谢!