iOS lets you check for the existence of other apps, but you do need to declare them in your Info.plist file, and you may need to provide an explanation to the App Review team if you try to query too many apps or apps that aren’t yours.
The key here is to give each of your apps a custom URL scheme. So, your first app might use “myapp1://“, your second app might use “myapp2://”, and so on. You don’t actually need to use these URLs, and they ought to be unique, so you should make them prefixed with your company name to be sure.
To try it out, right-click on your Info.plist file and choose Open As > Source Code. The file should end like this:
I’d like you to paste this XML directly before those lines:
<key>LSApplicationQueriesSchemes</key> <array> <string>myapp1</string> <string>myapp2</string> </array>
That registers two URL schemes, “myapp1://” and “myapp2://”, with iOS, which means you can now try to read them.
With that done, you can now add code like this to check whether the system is able to respond to “myapp1://” URLs:
If that returns true it means the app responsible for “myapp1://” is installed on the system, which means you know for sure the user has that other app installed.
Available from iOS 9.0
Did this solution work for you? Please pass it on!
Other people are reading…
About the Swift Knowledge Base
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Go from iOS to macOS the easy way!
If you like Hacking with Swift, you'll love Hacking with macOS – learn to build macOS apps today, using 18 real-world projects!