1、设置
2、代理方法
/// 打开App
static NSString *const identifierScheme = @"UrlSchemeControl://";
/// 打开App 并跳转到指定页面
static NSString *const identifierSecond = @"UrlSchemeControl://second";
/// 代理方法
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
NSString *scheme = url.absoluteString.lowercaseString;
if ([@[identifierScheme.lowercaseString, identifierSecond.lowercaseString] containsObject:scheme]) {
NSComparisonResult compareResult = [scheme compare:identifierSecond.lowercaseString];
if (compareResult == NSOrderedSame) {
// 打开App后发通知要打开哪个页面
[NSNotificationCenter.defaultCenter postNotificationName:@"NextClick" object:nil userInfo:nil];
}
// 打开App
return YES;
}
return NO;
}
/// 需要跳转的行为页面接收通知
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(nextClick) name:@"NextClick" object:nil];