Page 1 of 1

【TUYA SDK集成八十一难】iOS配网业务包配网成功后自定义跳转到任何页面

Posted: 2023年 Mar 6日 11:02
by taojingGino

iOS配网业务包配网成功后,正常情况会返回到根页面,当我想在配网成功后跳转到设备面板界面,或者场景界面,改如何实现呢?

目前的方案可以用注册TYActivatorExternalExtensionProtocol协议,实现gotoCustomVC方法来自己控制popViewController的层级

1.pod update更新到最新版本, 确认已拉取到最新的TuyaSmartActivatorBizBundle (3.34.5.9以上都可以)

2.拉起配网界面时传customJump:YES
id impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYActivatorProtocol)];
[impl gotoCategoryViewController];[impl activatorCompletion:TYActivatorCompletionNodeNormal customJump:YES completionBlock:NSArray * _Nullable deviceList {

}];

3.注册TYActivatorExternalExtensionProtocol协议
[[TuyaSmartBizCore sharedInstance] registerService:@protocol(TYActivatorExternalExtensionProtocol) withInstance:self];

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