WKWebView not loading webpage - renders blank screen in Swift
I have found the solution. The problem was being caused by AVG AntiVirus's webshield. For some reason AVG webshield treats all network communication from the simulator as fraudulent.
The following screenshot shows the safari app running on simulator. It says that www.apple.com is not safe or any other website.
The following screenshot is from system.log showing errors with webkit.
You can replicate this problem by installing AVG antivirus and turning on the webshield. WKWebview in your App(On the simulator) wouldn't load anything.
I don't understand why it wasn't working on an actual device tho. It could have been another problem with the device. I also deleted the derived data folder, the actual app and had restarted the device.
Thank you everybody for the answers and help.
WKWebView not loading slider images
Add following key into info.plist if not added
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Xcode Wkwebview not Loading
Your data is not being shared between the two UIViewControllers because your WKWebViews are different instances of each other and don't share the same data. It's as if you opened two different tabs in your web browser. If you're logged in, and the cart data is stored on the server, it should work, if you refresh the cart's page. If it's cookie based, you'll need to ensure those cookies are common among the two web views. Instead, use the tab to redirect to the cart's page instead of creating a new View Controller instance, or put the instance of the WKWebView into a static variable that can be shared between the two tabs. You'll have to do a bit of hiding/showing of that view so that you don't see it loading, but that can be handled via the delegate.
If the data is stored on the server, you can simple just reload the webpage within the viewDidAppear() overridden function in your VC. It really depends on what you're going for, but those are a few suggestions that'll work.
WKWebView is not loading url
First check did you set the permission in the info.plist file ? If not then you just need to take permission of TransportSecurit to YES in info.plist
file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Like below
WKWebView not working
// Add plist file
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>google.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
if WKWebView don't not support then declare .m file below code:
#import <WebKit/WebKit.h>
@interface WebScannerViewController()
{
WKWebView *webView;
}
@end
@implementation WebScannerViewController
- (void)viewDidLoad
{
[super viewDidLoad];
webView.hidden=YES;
webView.UIDelegate = self;
webView.navigationDelegate = self;
self.loadingSign.hidden = NO;
webView.frame=CGRectMake(0, 94, Width, Height-128);
}
Related Topics
Macos Remote Push Notifications Not Showing Alert Banner
Create Skspritenode with an Asset Programmatically
Arkit: Place Object on a Plane Doesn't Work Properly
Sklabelnode Text with Two Different Fonts and Colour. How Is This Possible
Why Are Image Views Sometimes Not Appearing in Collection View Cells
Call Function on App Termination in Swift
How to Center Nspopover When Using Swiftui
Swift-Animate Cashapelayer Stroke Color
Restrictions Around Protocols and Generics in Swift
Automatic Select a Date in Datepicker in Swift Language
How to Bind My Array Controller to My Core Data Model
Remove Cell When Button Pressed Inside Cell Customtableviewcell
Allow Line Editing When Reading Input from The Command Line
iOS Coredata Compatible with Both iOS 9 and iOS 10
How to Make Text Appear in Centre of The Image