Can't get WebKit to display web pageWhat is WebKit and how is it related to CSS?How can I force WebKit to redraw/repaint to propagate style changes?Getting current device language in iOS?Feasible to build your own WebKit-based UIWebView for iOS?WebKit issues with event.layerX and event.layerYJavascript / Chrome - How to copy an object from the webkit inspector as codeiPhone iOS will not display box-shadow properlyWhat are -moz- and -webkit-?Is it possible to animate the application of -webkit-tap-highlight in iOS Web?Parse push json IOS webview

What is the meaning of "you has the wind of me"?

401(k) investment after being fired. Do I own it?

Why is the return type for ftell not fpos_t?

Inadvertently nuked my disk permission structure - why?

What is "ass door"?

Do Rabbis get punished in Heaven for wrong interpretations or claims?

What is the purpose of this "red room" in Stranger Things?

What do teaching faculty do during semester breaks?

Spoken encryption

The seven story archetypes. Are they truly all of them?

For a MOSFET, does capacitive gate current only flow through to the source?

Why is a dedicated QA team member necessary?

Can I pay with HKD in Macau or Shenzhen?

What is the meaning of "a thinly disguised price"?

Film where a boy turns into a princess

Using "Kollege" as "university friend"?

Why do people say "I am broke" instead of "I am broken"?

Invert Some Switches on a Switchboard

Are gangsters hired to attack people at a train station classified as a terrorist attack?

How can I stop myself from micromanaging other PCs' actions?

Is Grandpa Irrational? Another Grandpa Mystery

Distribute large Tikz image on two A4 landscape

Is the apartment I want to rent a scam?

Determine if a triangle is equilateral, isosceles, or scalene



Can't get WebKit to display web page


What is WebKit and how is it related to CSS?How can I force WebKit to redraw/repaint to propagate style changes?Getting current device language in iOS?Feasible to build your own WebKit-based UIWebView for iOS?WebKit issues with event.layerX and event.layerYJavascript / Chrome - How to copy an object from the webkit inspector as codeiPhone iOS will not display box-shadow properlyWhat are -moz- and -webkit-?Is it possible to animate the application of -webkit-tap-highlight in iOS Web?Parse push json IOS webview






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:



@implementation FirstViewController

- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";

NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");


@end


The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.



I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.



How can I find out what is happening and fix it?










share|improve this question






















  • Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

    – Caleb
    Mar 26 at 15:59

















0















I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:



@implementation FirstViewController

- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";

NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");


@end


The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.



I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.



How can I find out what is happening and fix it?










share|improve this question






















  • Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

    – Caleb
    Mar 26 at 15:59













0












0








0








I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:



@implementation FirstViewController

- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";

NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");


@end


The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.



I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.



How can I find out what is happening and fix it?










share|improve this question














I'm trying to work out how to display a web page inside my IOS app. I've tried to carefully follow what information I can find. Here is what I'm using:



@implementation FirstViewController

- (void)viewDidLoad
[super viewDidLoad];
self.productURL = @"http://google.com/";

NSURL *url = [NSURL URLWithString:self.productURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

_webView = [[WKWebView alloc] initWithFrame:self.view.frame];
[_webView loadRequest:request];
_webView.frame = CGRectMake(self.view.frame.origin.x+50,self.view.frame.origin.y+50, self.view.frame.size.width-100, self.view.frame.size.height-200);
printf("nReady to add the Subview");
self.view.backgroundColor = [UIColor blueColor];
[self.view addSubview:_webView];
printf("nSubView has been added");


@end


The frame is offset in the above so I could color it and see that the subview would be positioned there. The web page should appear in the subview as I understand it, but I just get a blank page.



I also added NSExceptionDomains dictionary to my Info.plist and added google.com with it having a dictionary contains NSIncludesSubdomains set to true and NSExceptionAllowsInsecureHTTPLoads set to true thinking that might be the problem, but to no avail. I've tried several urls and same thing.



How can I find out what is happening and fix it?







ios objective-c webkit mobile-webkit






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 15:46









John WootenJohn Wooten

3352 silver badges12 bronze badges




3352 silver badges12 bronze badges












  • Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

    – Caleb
    Mar 26 at 15:59

















  • Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

    – Caleb
    Mar 26 at 15:59
















Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

– Caleb
Mar 26 at 15:59





Probably not the problem, but I'd add the view to its superview before loading the request. There's no reason for a web view to load a request if it's not installed in any view.

– Caleb
Mar 26 at 15:59












2 Answers
2






active

oldest

votes


















0














I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!



I could not find this before, but when I did and added it, it worked fine with the code just as above.






share|improve this answer






























    0














    I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".



    In your case you actually has 2 options:




    1. Add App Transport Security Settings.

    2. Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
      Security Settings.



    As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.






    share|improve this answer

























      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%2f55361207%2fcant-get-webkit-to-display-web-page%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!



      I could not find this before, but when I did and added it, it worked fine with the code just as above.






      share|improve this answer



























        0














        I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!



        I could not find this before, but when I did and added it, it worked fine with the code just as above.






        share|improve this answer

























          0












          0








          0







          I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!



          I could not find this before, but when I did and added it, it worked fine with the code just as above.






          share|improve this answer













          I found the problem! Apparently I needed to add the key 'App Transport Security Settings' as a dictionary to my Info.plist and add the key 'Allow Arbitrary Loads' as true to that. It now displays!



          I could not find this before, but when I did and added it, it worked fine with the code just as above.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 16:02









          John WootenJohn Wooten

          3352 silver badges12 bronze badges




          3352 silver badges12 bronze badges























              0














              I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".



              In your case you actually has 2 options:




              1. Add App Transport Security Settings.

              2. Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
                Security Settings.



              As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.






              share|improve this answer



























                0














                I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".



                In your case you actually has 2 options:




                1. Add App Transport Security Settings.

                2. Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
                  Security Settings.



                As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.






                share|improve this answer

























                  0












                  0








                  0







                  I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".



                  In your case you actually has 2 options:




                  1. Add App Transport Security Settings.

                  2. Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
                    Security Settings.



                  As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.






                  share|improve this answer













                  I know you have found the solution. But here I want to explain what is wrong with the code. The code is actually fine. The issue is you are trying to open an insecure URL http://google.com/. Any URL that starts with http:// will get blocked by iOS. Only URL that starts with https:// will be allowed without any "App Transport Security Settings".



                  In your case you actually has 2 options:




                  1. Add App Transport Security Settings.

                  2. Ensure you only calls https:// URL. You can change https://google.com and it should work without adding any App Transport
                    Security Settings.



                  As for the options that you add "Allow Arbitrary Loads" is ok for testing, but what you really need to do is add exception domains in your App Transport Security Settings. That way your app only accepts related URL only, and not ANY old URL that could've been opened by malicious url injection.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 23:47









                  GeneCodeGeneCode

                  5,7676 gold badges35 silver badges66 bronze badges




                  5,7676 gold badges35 silver badges66 bronze badges



























                      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%2f55361207%2fcant-get-webkit-to-display-web-page%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

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해