I'm stumped on this one. I have written the code as it is below. I am trying to do different things depending on which url is loaded in my web view. The URL that is supposed to load is http//myURL.com/live.php but you need to be logged in to access that url. Since you are not logged in it then goes to http//myURL.com/index.php .
I have removed the ':' from the links so they won't get hyperlinked. That is not the error
When I run it like this, the print function displays the following in my log-->
Optional(http//myURL.com/index.php).
Already logged in
It should print "Not Logged In" as the URL being printed and the URL in my if statement match.
I have tried adding "Optional" and the parenthesis as it is being printed, but that doesn't work either. Am I doing something wrong (and most likely stupid)?
Please help. Thanks!
func webViewDidFinishLoad(webView: UIWebView) {
print(loginWebView.request?.mainDocumentURL)
if (loginWebView.request?.mainDocumentURL == "http://myURL.com/index.php"){
print("Not Logged In")
} else {
print("Already Logged In")
}
