Hi.
I want to create a new UIScene when my app opens a file in some condition.
So I wrote requestSceneSessionActivation in scene(_:openURLContexts:).
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
		let options = UIScene.ActivationRequestOptions()
		options.requestingScene = scene
	
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: createUserActivity(for: url), options: options) { error in
			print(debug: error)
		}
	}
private func createUserActivity(for url: URL) -> NSUserActivity {
		let userActivity = NSUserActivity(activityType: getUserActivityType(idx: 1)!)
		userActivity.requiredUserInfoKeys = ["url"]
		userActivity.addUserInfoEntries(from: ["url": url])
		(UIApplication.shared.delegate as? AppDelegate)?.url = url
		 return userActivity
		}
But scene(_:willConnectTo:options:) gets an empty userInfo.
Is it impossible to include an URL of a file in iCloud Drive in NSUserActivity#userInfo?
I guess that it is not because it is a Security-Scoped URL.
Is my understanding right?
And if so, how can I pass a Security-Scoped URL to a scene to be created?
Of course, If you make a property for it in your AppDelegate, you can do it but I think that it is not normal.
Thank you in advance,
Post
Replies
Boosts
Views
Activity
Hi.I tried to use "live listen" by my beats headset but failed. It seems that "live listen" feature is enabled only for AirPods (Pro) or "made for iPhone" hearing aids.And I also tried to switch an input device to builtInMic by setPreferredInput on Swift Playgrounds.It succeeded but it also switches the output to built in speaker.Since I want to keep the output to the headset, I failed to make my own "live listen".Is "live listen" setting an private API?Or is it possible to make my own "live listen" app if I have AirPods?Thanks.