citrix / citrix-mam-sdks

The MAM SDK instrument your apps to enable enforcing policies and controls that are configured in Citrix Endpoint Management.
https://developer.cloud.com/citrixworkspace/mobile-application-integration
11 stars 3 forks source link

Programmatically Determine if Secure Hub is Installed #100

Closed roanutil closed 8 months ago

roanutil commented 8 months ago

For the iOS MAM SDK, what is the best way to determine at runtime if the 'Secure Hub' app is installed and logged in? I can see in the logs that the SDK is internally looking for it and may alert in the UI that it is not installed.

makunterry commented 8 months ago

The 'Secure Hub' URL is 'com.citrix.securehub' and you can use below method to determine it is installed or not: https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl?language=objc By doing this, you need to make sure your application Info.plist added 'com.citrix.securehub' correctly in the 'LSApplicationQueriesSchemes' field.

roanutil commented 8 months ago

@makunterry Thanks for your help.

I've added the com.citrix.securehub scheme to the LSApplicationQueriesSchemes array in my Info.plist. With the below code sample, it never returns true. Secure Hub is installed and entering the com.citrix.securehub:// URL into Safari does open the app.

if await UIApplication.shared.canOpenURL(URL(string: "com.citrix.securehub://")!) {
    return
} else {
    fatalError()
}
makunterry commented 8 months ago

@roanutil thanks for your updating. Please check carefully in your Info.plist and refer to the apple document: https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl?language=objc

If the safari can open SecureHub by using 'om.citrix.securehub://' then the URL is correct.