ios 进程杀死,外部链接跳转到指定页面

配置好Universal link后
第一步
AppDelegate 中

@property (strong, nonatomic) NSString *jumpUrl;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   NSDictionary *activityDictionary = launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
    if (activityDictionary) {
        NSUserActivity *activity = [activityDictionary objectForKey:@"UIApplicationLaunchOptionsUserActivityKey"];
        NSString *urlString = activity.webpageURL.absoluteString;
        NSURL *url = [NSURL URLWithString:urlString];
        NSString *str = [NSString stringWithFormat:@"%@",url];
        self.jumpUrl =str;
        return YES;
    }

第二步
首页中取jumpUrl进行接下来的操作

- (void)viewDidLoad {
    [super viewDidLoad];
    AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;
    NSString *url=app.jumpUrl;
}

你可能感兴趣的:(ios 进程杀死,外部链接跳转到指定页面)