我在回调下浏览了Branch on Cocoapods的参考文档,它建议保留路由逻辑。这是我需要实现的逻辑,但除了 if-else 逻辑之外我无法弄清楚任何东西。我想引入一个 key--> 功能逻辑,应该怎么做?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Branch *branch = [Branch getInstance];
[branch initSessionWithLaunchOptions:launchOptions isReferrable:YES andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
// route the user based on what's in params
// currently implemented as if-else logic
if ([params objectForKey:@"key1"]){
/*Do something*/
}
else if ([params objectForKey:@"key2"]){
/*Do something else*/
}
}];
return YES;
}