0
class SSOViewController: UIViewController, UIWebViewDelegate
{

@IBOutlet weak var ssoWebView: UIWebView!
var activityData : ActivityData!

var ssoUrl: String!

override func viewDidLoad()
{
    super.viewDidLoad()
    activityData = ActivityData()
    ssoWebView.delegate = self
    ssoWebView.loadRequest(URLRequest(url: URL(string: ssoUrl)!) )
}

override func didReceiveMemoryWarning()
{
    super.didReceiveMemoryWarning()
}

func webViewDidStartLoad(_ webView: UIWebView)
{
    NVActivityIndicatorView.DEFAULT_BLOCKER_SIZE = CGSize(width: 45, height: 45)
    NVActivityIndicatorPresenter.sharedInstance.startAnimating(activityData)
}

func webViewDidFinishLoad(_ webView: UIWebView)
{
    //NVActivityIndicatorPresenter.sharedInstance.stopAnimating()
}

func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool
{
    print(request.mainDocumentURL ?? "no url")
    return false
}

}

This is what I did to load the content into the webview and in webViewDidStartLoad method and webViewDidFinishLoad method just added activity indicator. Those two methods are not firing up either.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Prabu Raj
  • 577
  • 1
  • 6
  • 11
  • ensure once didfail error called or not – Anbu.Karthik Aug 09 '17 at 12:17
  • ssoUrl -- ensure once it contain data or not – Anbu.Karthik Aug 09 '17 at 12:18
  • 1
    and also check once you were added the NSTransportsecurity in your app – Anbu.Karthik Aug 09 '17 at 12:19
  • SSOURL contains data – Prabu Raj Aug 09 '17 at 12:22
  • can you print once `ssoUrl` – Anbu.Karthik Aug 09 '17 at 12:22
  • how do i add NSTransportsecurity to my app? @Anbu.Karthik – Prabu Raj Aug 09 '17 at 12:23
  • I tried hard coding "https://www.google.com". Even that didn't work @Anbu.Karthik – Prabu Raj Aug 09 '17 at 12:24
  • see this https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ – Anbu.Karthik Aug 09 '17 at 12:25
  • Please check this https://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9 – Udaya Sri Aug 09 '17 at 12:25
  • @PrabuRaj - in your project I faced the issue of this https://stackoverflow.com/questions/39520499/class-plbuildversion-is-implemented-in-both-frameworks, its is the one of the bug in apple, in here use replace of UIWebView with WKWebView – Anbu.Karthik Aug 09 '17 at 13:44
  • **Moderator Note:** [Stack Overflow is not a discussion forum](https://stackoverflow.com/tour). The comments here had gotten out of control. Comments are not to be used for extended discussion or debugging sessions. If you have information that needs to be added to your question, you need to [edit] it in. If you are asked for clarification, then that clarification needs to be [edit]ed into your question. If you need step-by-step assistance, then you are not yet ready to ask a question on Stack Overflow. – Cody Gray - on strike Aug 09 '17 at 18:05

1 Answers1

0

Check Transport security in your info.plist

  1. Open info.plist file

  2. Add key called NSAppTransportSecurity as a Dictionary

  3. Add subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES

enter image description here

SAURABH SANWAL
  • 139
  • 1
  • 11