openUrlContexts issue

I'm having trouble calling the openUrlContexts function from SceneDelegate. I have defined a UTI for an exported backup file, and it saves to the files app with no problems. In the simulator my app opens when the saved file is clicked, so it does make the connection there, but no function is called. Does there need to be some setup code to make this function work, or should it automatically fire up when the file is launched?

Replies

I've discovered that the code below is need in willConnectTo session, so that's one step forward :-)


self.scene(scene, openURLContexts: connectionOptions.urlContexts)

I'm still struggling with this. I've read the UIScene documentation but still cannot see where I am going wrong. As I said, my file opens the app, it just doesn't call the openURLContexts function. As I understand it, iOS should automatically pass information about the file that opened the app to the ScenesDelegate, which would include the url to the file. Or do I have that wrong?

The line of code that I mentioned above, that I placed in the willConnectTo method only calls the openURLContexts method when the app is initially launched, not when it is launched from a saved file. Any help will be much appreciated.

Did you read this ? Seems they had to call "manually"

https://stackoverflow.com/questions/58973143/method-scene-openurlcontexts-is-not-called
Thank you. That one did slip by me. I’ve been doing a lot of experimenting in practice projects and the method is being called now without having to manually call it. I’m not sure what the initial problem was, but I suspect a setting in the info.plist. If the app is set to not run in the background the app Will start from an exported file, but openURL does not get called.