I have an iOS app, which is written in the swift programming. Its designed in such a way that it only renders the web based application in the iOS device. If I open that url from firefox then it asks for the username/password. "Restricted Area", a javascript kind of window appears. After I enter login password, I am able to enter into the website.
How could I make this login/password work from mobile app. Because in iOS app, its pointing to this website and how do I supply login/password for it. I solved it in android by using onRecieveAuthRequest an API from Webview, but unable to solve in iOS swift
Below is the code, My class MainViewController.swift is extending UIViewController
class MainViewController: UIViewController, UIWebViewDelegate, MFMailComposeViewControllerDelegate {
Below is the URL code, I tried to execute but it fails during execution and not the right way to pass username password for the secure server
override func viewDidLoad() {
super.viewDidLoad();
webView.delegate = self;
let url = NSURL (string: "http://myUserName:myPassword@http://mysecureTestServer.com/mobile/");
let requestObj = NSURLRequest(URL: url);
webView.loadRequest(requestObj);
}