From 01fca4418ed1fa65d24e592a3fb9065dd5fddac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Mon, 15 Apr 2024 22:44:59 +0200 Subject: [PATCH] =?UTF-8?q?fix(ios):=20fix=20=E2=80=9Chandleurl=E2=80=9D?= =?UTF-8?q?=20event=20when=20using=20scenes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TitaniumKit/TitaniumKit/Sources/API/TiApp.m | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m index bf4558f7789..7ea6cf1b896 100644 --- a/iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m +++ b/iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m @@ -324,7 +324,20 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( return YES; } -// Handle URL-schemes / iOS >= 9 +- (void)scene:(UIScene *)scene openURLContexts:(NSSet *)URLContexts +{ + UIOpenURLContext *primaryContext = URLContexts.allObjects.firstObject; + + NSDictionary *options = @{ + UIApplicationOpenURLOptionsSourceApplicationKey : NULL_IF_NIL(primaryContext.options.sourceApplication) + }; + + [self application:[UIApplication sharedApplication] openURL:primaryContext.URL options:options]; +} + +// Handle URL-schemes. Note that this selector is not called automatically anymore in iOS 13+ +// because of the scene management. Instead, the above "scene:openURLContexts:" selector is called +// that forwards the call for maximum backwards compatibility - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { [self tryToInvokeSelector:@selector(application:openURL:options:)