'Unable to load the URL in iOS WebView when the button is clicked for the first time

The mobile app is all about showing a SharePoint website in a WebView. I am trying to get the URL of a third party website on click of a button which is a part of the WebView. Based on this URL, I am trying to show an alert. On the first click of the button, the URL I am looking for, is not loading and hence the alert is not showing up. However, I am able to see the URL for the second click of the button and I'm able to see the alert as well.

Any help would be appreciated.

Thanks in Advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source