How do I open BlackBerry UEM Client app on my iPhone XR from Swift 5. What is the client path and/or URL? Thank you.

I am in the process of (learning) writing Xcode (11.4.1) / Swift 5 and trying to open BlackBerry UEM Client App in my test code on iPhone XR. Here is the code in Swift-

The following is in the CodeViewController.swift:


The info.plist has a new addition of “LSApplicationQueriesSchemes with “UEM Client” as Item 0 in its defined Array


// --------------------------

1. Import UIKit

2. Import AVFoundation

3. Import LocalAuthentication


4. Class CodeViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

5. .

6. .

7. .

8. Override func viewDidLoad() {

9. Super.viewDidLoad()

10. }

11. .

12. .

13. .

14. @IBAction func executeTestCase(_ sender: any) {


15. let application = UIApplication.shared

16. let uemClientPath = "UEM Client://"

17. let appUrl = URL(string: uemClientPath)!

18. if application.canOpenURL(appUrl) {

19. application.open(appUrl, options: {:}, completionHandler: nil)

20. print(" Opened UEM Client App")

21. } else {

22. print("Can't open UEM Client App on the iPhone")

23. }

24. .

25. .

26. .

27. }


// --------------------------


The iPhone is connected to the Apple laptop. Upon compilation, the app is executed automatically on the iPhone and it crashes at line # 17 with the following –

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/wamiqsattar/……/CodeViewController.swift, line 17


On line # 16, "UEM Client://", should not have a space. However, I do not know what the client path and/or the URL should be for the (BlackBerry) UEM Client app on the iPhone Xr. Can any of you please give me a viable advice on this Xcode/Swift Coding? What I am missing or what I need to do. I am guessing the (BlackBerry) UEM Client app has to have a special “client path”. Thank you.

Regards,

Wamiq

Replies

I am … trying to open BlackBerry UEM Client App in my test code

iOS does not have a general-purpose way to open a specific app. You can open an app via

open(_:options:completionHandler:)
, but you need to supply a URL that the app supports. There’s no general way to work out what URLs a specific app supports. You’ll need to consult the documentation for that app and, if that doesn’t pan out, ask the app vendor.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"