NSUserActivity missing userInfo for a newly requested scene

I'm creating a new scene like:

Code Block
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil/*options*/) { error in
      dPrint("\(error)")
    }

The activity parameter has userInfo that I need in the new scene; for example,

Code Block
    activity.userInfo = ["sampleKey":"sampleData"]

Here's how I'm creating the new scene:

Code Block
  func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {    
    guard let windowScene = scene as? UIWindowScene else { return }
    window = UIWindow(windowScene: windowScene)
    window?.rootViewController = ContainerViewController(to: createSplitViewController())
    window?.makeKeyAndVisible()
    scene.title = SystemData.appName
    if appDelegate.isOnboardingNeeded, let containerController = window?.rootViewController as? ContainerViewController {
      appDelegate.launchOnboardingIfNeeded(with: containerController)
    }
    if let activity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
      dPrint("\(#function) \(activity)")
      masterViewController?.restore(from: activity, isStandalone: false, persistentId: scene.session.persistentIdentifier)
    }
  }


The print statement has an empty userInfo.

What's the problem?

I'm running into the same issue. I tried setting the requiredUserInfoKeys and using an NSUserActivityDelegate with needsSave with no effect. Did you or someone else find a solution to this issue?

I'm running into the same issue. I tried setting the requiredUserInfoKeys and using an NSUserActivityDelegate with needsSave with no effect. Did you or someone else find a solution to this issue?

Found a solution for my specific issue on iOS 14: There seems to be an issue with URL types in the userInfo dictionary. Not sure if the value itself is evaluated but replacing the URL by a string solved the issue for me. My dictionary only had two entries, a String and a URL. Both values were cleared. Now the two Strings are passed to the new scene.

NSUserActivity missing userInfo for a newly requested scene
 
 
Q