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
// --------------------------
-
Import UIKit
-
Import AVFoundation
-
Import LocalAuthentication
-
Class CodeViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
-
.
-
.
-
.
-
Override func viewDidLoad() {
-
Super.viewDidLoad()
-
}
-
.
-
.
-
.
-
@IBAction func executeTestCase(_ sender: any) {
-
let application = UIApplication.shared
-
let uemClientPath = "UEM Client://"
-
let appUrl = URL(string: uemClientPath)!
-
if application.canOpenURL(appUrl) {
-
application.open(appUrl, options: {:}, completionHandler: nil)
-
print(" Opened UEM Client App")
-
} else {
-
print("Can't open UEM Client App on the iPhone")
-
}
-
.
-
.
-
.
-
}
// --------------------------
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 Sattar