When I tap on the result of the Core Spotlight search, the app launches, but the function in AppDelegate.swift
doesn't get called:
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
print("called")
}
which contains a logic for navigating to a specific view controller and loading data.
Some people here seem to recommend using SceneDelegate.swift
:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
print("called"
}
but doesn't get called from Core Spotlight, either.
The only functions that seem to be being called are:
func sceneDidBecomeActive(_ scene: UIScene) {}
func sceneWillEnterForeground(_ scene: UIScene) {}
in SceneDelegate.swift
, but doesn't have the needed userActivity
parameter.