WK WebView calling completion handler but now showing anythingXcode 9 GM - WKWebView NSCoding support was broken in previous versionsWhy does using Nsurl request keeps telling me to rename to “init(url)”How to detect tableView cell touched or clicked in swiftWKWebView loads HTML content too slowly in iOS9 using swiftWKNavigationDelegate Crashing App on AssignmentWKWebView is not working with FileManager for documentDirectoryis WKCompositingView blocking touches?BMI app print result is 0 even with variable being hard codedHow to fetch cookies values from WKWebView in Swift 4?How to Insert CSS from a URL in WKWebView though HTML content from URL is loaded successfullyUser permission from webViewKit button clickComposing mail from WKWebView doesn't load pictures?

Setting up the trap

Justifying Affordable Bespoke Spaceships

Bent arrow under a node

Why is Havana covered in 5-digit numbers in Our Man in Havana?

How can I make a scatter plot from a matrix with many y-axis values for each x-axis value?

Scaling an object to change its key

How Hebrew Vowels Work

Can I apply for a working holiday visa at age 30 and get the full 12 months?

What is this plant I saw for sale at a Romanian farmer's market?

A conjecture concerning symmetric convex sets

Time at 1 g acceleration to travel 100 000 light years

How much steel armor can you wear and still be able to swim?

Is using legacy mode instead of UEFI mode a bad thing to do?

"Correct me if I'm wrong"

Why things float in space, though there is always gravity of our star is present

How did Frodo know where the Bree village was?

Am I legally required to provide a (GPL licensed) source code even after a project is abandoned?

How do I find which software is doing an SSH connection?

Need help understanding the double sharp turn in Chopin's prelude in e minor

Why is it easier to balance a non-moving bike standing up than sitting down?

Implementation of the Jacobi Symbol in C

I just entered the USA without passport control at Atlanta airport

Name for a function whose effect is canceled by another function?

Is there any possible way to get these hearts as Adult Link?



WK WebView calling completion handler but now showing anything


Xcode 9 GM - WKWebView NSCoding support was broken in previous versionsWhy does using Nsurl request keeps telling me to rename to “init(url)”How to detect tableView cell touched or clicked in swiftWKWebView loads HTML content too slowly in iOS9 using swiftWKNavigationDelegate Crashing App on AssignmentWKWebView is not working with FileManager for documentDirectoryis WKCompositingView blocking touches?BMI app print result is 0 even with variable being hard codedHow to fetch cookies values from WKWebView in Swift 4?How to Insert CSS from a URL in WKWebView though HTML content from URL is loaded successfullyUser permission from webViewKit button clickComposing mail from WKWebView doesn't load pictures?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I want to load privacy policy (simple string) from server say, https://*****.com/privacy-policy.html to my app.



What I have tried till now is given below:



class TermsAndConditionsDetailViewController: UIViewController, WKNavigationDelegate 
@IBOutlet weak var contentView: UIView!
var webView: WKWebView!

func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation!)
print("loaded")

override func viewDidLoad()
super.viewDidLoad()

webView = WKWebView()
contentView.addSubview(webView)
let myURL = URL(string: "https://***.com/privacy-policy.html")
let myRequest = URLRequest(url: myURL!)
webView.navigationDelegate = self

//I have tried these both one by one
webView.loadHTMLString("", baseURL: myURL)
webView.load(myRequest)




When i run this code "loaded" gets printed after 2 - 3 seconds but it doesn't show anything on the screen. I have been searching this issue for some time now and have tried to play around with the code. I have cross checked the constraints of all view specially contentView, but no luck.










share|improve this question






















  • your URL is working in browser?

    – Dharmesh
    Mar 25 at 6:12











  • Yes, its working

    – kinza
    Mar 25 at 6:14











  • @kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

    – Nikunj Kumbhani
    Mar 25 at 6:17











  • Try this one stackoverflow.com/a/52252357/10150796 it's working fine

    – Nikunj Kumbhani
    Mar 25 at 6:19











  • @NikunjKumbhani I have tried the above link but no effect.

    – kinza
    Mar 25 at 6:32

















-1















I want to load privacy policy (simple string) from server say, https://*****.com/privacy-policy.html to my app.



What I have tried till now is given below:



class TermsAndConditionsDetailViewController: UIViewController, WKNavigationDelegate 
@IBOutlet weak var contentView: UIView!
var webView: WKWebView!

func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation!)
print("loaded")

override func viewDidLoad()
super.viewDidLoad()

webView = WKWebView()
contentView.addSubview(webView)
let myURL = URL(string: "https://***.com/privacy-policy.html")
let myRequest = URLRequest(url: myURL!)
webView.navigationDelegate = self

//I have tried these both one by one
webView.loadHTMLString("", baseURL: myURL)
webView.load(myRequest)




When i run this code "loaded" gets printed after 2 - 3 seconds but it doesn't show anything on the screen. I have been searching this issue for some time now and have tried to play around with the code. I have cross checked the constraints of all view specially contentView, but no luck.










share|improve this question






















  • your URL is working in browser?

    – Dharmesh
    Mar 25 at 6:12











  • Yes, its working

    – kinza
    Mar 25 at 6:14











  • @kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

    – Nikunj Kumbhani
    Mar 25 at 6:17











  • Try this one stackoverflow.com/a/52252357/10150796 it's working fine

    – Nikunj Kumbhani
    Mar 25 at 6:19











  • @NikunjKumbhani I have tried the above link but no effect.

    – kinza
    Mar 25 at 6:32













-1












-1








-1








I want to load privacy policy (simple string) from server say, https://*****.com/privacy-policy.html to my app.



What I have tried till now is given below:



class TermsAndConditionsDetailViewController: UIViewController, WKNavigationDelegate 
@IBOutlet weak var contentView: UIView!
var webView: WKWebView!

func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation!)
print("loaded")

override func viewDidLoad()
super.viewDidLoad()

webView = WKWebView()
contentView.addSubview(webView)
let myURL = URL(string: "https://***.com/privacy-policy.html")
let myRequest = URLRequest(url: myURL!)
webView.navigationDelegate = self

//I have tried these both one by one
webView.loadHTMLString("", baseURL: myURL)
webView.load(myRequest)




When i run this code "loaded" gets printed after 2 - 3 seconds but it doesn't show anything on the screen. I have been searching this issue for some time now and have tried to play around with the code. I have cross checked the constraints of all view specially contentView, but no luck.










share|improve this question














I want to load privacy policy (simple string) from server say, https://*****.com/privacy-policy.html to my app.



What I have tried till now is given below:



class TermsAndConditionsDetailViewController: UIViewController, WKNavigationDelegate 
@IBOutlet weak var contentView: UIView!
var webView: WKWebView!

func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation!)
print("loaded")

override func viewDidLoad()
super.viewDidLoad()

webView = WKWebView()
contentView.addSubview(webView)
let myURL = URL(string: "https://***.com/privacy-policy.html")
let myRequest = URLRequest(url: myURL!)
webView.navigationDelegate = self

//I have tried these both one by one
webView.loadHTMLString("", baseURL: myURL)
webView.load(myRequest)




When i run this code "loaded" gets printed after 2 - 3 seconds but it doesn't show anything on the screen. I have been searching this issue for some time now and have tried to play around with the code. I have cross checked the constraints of all view specially contentView, but no luck.







ios swift wkwebview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 6:11









kinzakinza

126117




126117












  • your URL is working in browser?

    – Dharmesh
    Mar 25 at 6:12











  • Yes, its working

    – kinza
    Mar 25 at 6:14











  • @kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

    – Nikunj Kumbhani
    Mar 25 at 6:17











  • Try this one stackoverflow.com/a/52252357/10150796 it's working fine

    – Nikunj Kumbhani
    Mar 25 at 6:19











  • @NikunjKumbhani I have tried the above link but no effect.

    – kinza
    Mar 25 at 6:32

















  • your URL is working in browser?

    – Dharmesh
    Mar 25 at 6:12











  • Yes, its working

    – kinza
    Mar 25 at 6:14











  • @kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

    – Nikunj Kumbhani
    Mar 25 at 6:17











  • Try this one stackoverflow.com/a/52252357/10150796 it's working fine

    – Nikunj Kumbhani
    Mar 25 at 6:19











  • @NikunjKumbhani I have tried the above link but no effect.

    – kinza
    Mar 25 at 6:32
















your URL is working in browser?

– Dharmesh
Mar 25 at 6:12





your URL is working in browser?

– Dharmesh
Mar 25 at 6:12













Yes, its working

– kinza
Mar 25 at 6:14





Yes, its working

– kinza
Mar 25 at 6:14













@kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

– Nikunj Kumbhani
Mar 25 at 6:17





@kinza Can you please tell me why you add contentView and add webView as a subview inside that instant of you direct from the storyboard.

– Nikunj Kumbhani
Mar 25 at 6:17













Try this one stackoverflow.com/a/52252357/10150796 it's working fine

– Nikunj Kumbhani
Mar 25 at 6:19





Try this one stackoverflow.com/a/52252357/10150796 it's working fine

– Nikunj Kumbhani
Mar 25 at 6:19













@NikunjKumbhani I have tried the above link but no effect.

– kinza
Mar 25 at 6:32





@NikunjKumbhani I have tried the above link but no effect.

– kinza
Mar 25 at 6:32












1 Answer
1






active

oldest

votes


















1














You forget to add frame for your WKWebView



just add



webView = WKWebView(frame: self.contentView.frame)


after



webView = WKWebView()


and it will work fine.






share|improve this answer























  • Oh thank you so much. This is the reason why I like adding views from storyboard :D

    – kinza
    Mar 25 at 6:38











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332112%2fwk-webview-calling-completion-handler-but-now-showing-anything%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You forget to add frame for your WKWebView



just add



webView = WKWebView(frame: self.contentView.frame)


after



webView = WKWebView()


and it will work fine.






share|improve this answer























  • Oh thank you so much. This is the reason why I like adding views from storyboard :D

    – kinza
    Mar 25 at 6:38















1














You forget to add frame for your WKWebView



just add



webView = WKWebView(frame: self.contentView.frame)


after



webView = WKWebView()


and it will work fine.






share|improve this answer























  • Oh thank you so much. This is the reason why I like adding views from storyboard :D

    – kinza
    Mar 25 at 6:38













1












1








1







You forget to add frame for your WKWebView



just add



webView = WKWebView(frame: self.contentView.frame)


after



webView = WKWebView()


and it will work fine.






share|improve this answer













You forget to add frame for your WKWebView



just add



webView = WKWebView(frame: self.contentView.frame)


after



webView = WKWebView()


and it will work fine.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 6:31









DharmeshDharmesh

53.9k23131151




53.9k23131151












  • Oh thank you so much. This is the reason why I like adding views from storyboard :D

    – kinza
    Mar 25 at 6:38

















  • Oh thank you so much. This is the reason why I like adding views from storyboard :D

    – kinza
    Mar 25 at 6:38
















Oh thank you so much. This is the reason why I like adding views from storyboard :D

– kinza
Mar 25 at 6:38





Oh thank you so much. This is the reason why I like adding views from storyboard :D

– kinza
Mar 25 at 6:38



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332112%2fwk-webview-calling-completion-handler-but-now-showing-anything%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript