Page 1 of 1

iOS 配网业务包如何在配网结束后跳转自定义页面

Posted: 2024年 Nov 15日 17:28
by ZoeTuya

配网完成后,仅有一个设备的情况下会跳转设备面板,多个设备的情况下会退出配网。那如何在配网结束后跳转至指定页面呢?

1、拉起配网界面时传customJump:YES, 禁止配网结束后跳转设备面板

Code: Select all

id<ThingActivatorProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingActivatorProtocol)];
[impl gotoCategoryViewController];
[impl activatorCompletion:ThingActivatorCompletionNodeNormal customJump:YES completionBlock:^(NSArray * _Nullable deviceList) {

}];

2、注册 ThingActivatorExternalExtensionProtocol 协议

Code: Select all

[[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingActivatorExternalExtensionProtocol) withInstance:self];

3、实现自动跳转方法

Code: Select all

- (BOOL)gotoCustomVC:(NSDictionary *_Nullable)userInfo {
    for (UIViewController *controller in self.navigationController.viewControllers) {
        if (controller isKindOfClass:[XXViewController Class]) {
           [self.navigationController popToViewController:controller animated:YES];
           return YES;
        }
    }
    return NO;
}