Reputation: 27
I am writing a multi-platform App using Net Maui. The app may produce an MsWord file if requested by the user. I know how to check if MsWord is installed on most OSes, except in IOS. How do I find out if MsWord is installed on IOS?
I cannot find any information on this problem.
Upvotes: 0
Views: 148
Reputation: 3402
The official Microsoft deeplink docs can be found here
Application | Protocol |
---|---|
Excel | ms-excel: |
OneNote | onenote: |
PowerPoint | ms-powerpoint: |
Word | ms-word: |
Here is a link on how to open other iOS apps in Net Maui example
bool supportsUri = await Launcher.Default.CanOpenAsync("ms-word://");
Apple requires that you define the schemes you want to use. Add the LSApplicationQueriesSchemes key and schemes to the Platforms/iOS/Info.plist and Platforms/MacCatalyst/Info.plist files:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>ms-word</string>
</array>
The elements are the URI schemes preregistered with your app. You can't use schemes outside of this list.
if (supportsUri)
await Launcher.Default.OpenAsync("ms-word://someFileName");
Below is an example of how how it's done natively.
Add the url schemes into your Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>ms-word</string>
</array>
And then in your code you can check to see if the app is installed and launch the app:
guard let url = URL(string: "ms-word://") else { return }
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
Upvotes: 4