How to open other apps from my app similar to Launcher app. canOpenURL, LSApplicationQueriesSchemes

I have a hard time figuring out how I can open other apps from my app (either in app or from widget). I'm aware that I can add up to 50 URLS in LSApplicationQueriesSchemes. So I can predefined only 50 apps that users can open. At least this is what I thought.

But, I have tried app like Launcher and a few other apps that offer widgets that can open other apps, like being a launcher.

How can those app do this? They cover so many apps. Like in a case of Launcher, it allows a user to search for app from App Store, and then create a widget that can open that app. I have tried some apps that are very niche and they still work.

Any recommendation is very appreciated.

Thanks!

Replies

LSApplicationQueriesSchemes is only used with canOpenURL. It's not used with openURL. So you can open all of the apps you want. You are just limited if you want to check for installed apps with canOpenURL.

From the docs for canOpenURL:

Unlike this method, the openURL:options:completionHandler: method isn’t constrained by the LSApplicationQueriesSchemes requirement. If an app is available to handle the URL, the system will launch it, even if you haven’t declared the scheme.