Skip to content

Commit a0a3aea

Browse files
authored
fix(ios): fix some open issues related to scenes (#14020)
* fix(ios): fix “handleurl” event when using scenes * fix(ios): fix log server from not being started on physical device
1 parent 9038a65 commit a0a3aea

File tree

1 file changed

+24
-3
lines changed
  • iphone/TitaniumKit/TitaniumKit/Sources/API

1 file changed

+24
-3
lines changed

iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,20 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
324324
return YES;
325325
}
326326

327-
// Handle URL-schemes / iOS >= 9
327+
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts
328+
{
329+
UIOpenURLContext *primaryContext = URLContexts.allObjects.firstObject;
330+
331+
NSDictionary<UIApplicationOpenURLOptionsKey, id> *options = @{
332+
UIApplicationOpenURLOptionsSourceApplicationKey : NULL_IF_NIL(primaryContext.options.sourceApplication)
333+
};
334+
335+
[self application:[UIApplication sharedApplication] openURL:primaryContext.URL options:options];
336+
}
337+
338+
// Handle URL-schemes. Note that this selector is not called automatically anymore in iOS 13+
339+
// because of the scene management. Instead, the above "scene:openURLContexts:" selector is called
340+
// that forwards the call for maximum backwards compatibility
328341
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options
329342
{
330343
[self tryToInvokeSelector:@selector(application:openURL:options:)
@@ -1185,12 +1198,20 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op
11851198
[self tryToInvokeSelector:@selector(scene:willConnectToSession:options:)
11861199
withArguments:[NSOrderedSet orderedSetWithObjects:scene, connectionOptions, nil]];
11871200

1188-
// If a "application-launch-url" is set, launch it directly
1189-
[self launchToUrl];
1201+
// Catch exceptions
1202+
[TiExceptionHandler defaultExceptionHandler];
1203+
1204+
// Enable device logs (e.g. for physical devices)
1205+
if ([[TiSharedConfig defaultConfig] logServerEnabled]) {
1206+
[[TiLogServer defaultLogServer] start];
1207+
}
11901208

11911209
// Initialize the root-controller
11921210
[self initController];
11931211

1212+
// If a "application-launch-url" is set, launch it directly
1213+
[self launchToUrl];
1214+
11941215
// Boot our kroll-core
11951216
[self boot];
11961217

0 commit comments

Comments
 (0)