dkirlin
dkirlin

Reputation: 315

UIWebView displaying as a white screen

In my app, I have a view controller that contains a UIWebView. This View Controller has the UIWebView as an IBOutlet. When loading the view I just get a white screen with my navigation bar at the top. Here is the code for loading the UIWebView. Originally my completeURL wasn't being formatted correctly and was just null. No information I can scour through online seems to be able to help me with this issue.

-(void) viewWillAppear:(BOOL)animated
{
    NSString *stringURL = [NSString stringWithFormat:@"www.ncbi.nlm.nih.gov/pubmed/?term=%@", _URL];
    NSURL *completeURL = [NSURL URLWithString: [stringURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
    NSURLRequest *request = [NSURLRequest requestWithURL:completeURL];
    [_webView loadRequest:request];
    NSLog(@"%@", request);
}

Upvotes: 2

Views: 1968

Answers (2)

Balu
Balu

Reputation: 8460

once check this line may be problem is here replace this once and check it,

NSString *stringURL = [NSString stringWithFormat:@"http://www.ncbi.nlm.nih.gov/pubmed?term=%@", _URL];

Upvotes: 1

user2159978
user2159978

Reputation: 2709

I think the problem could be in:

NSURL *completeURL = [NSURL URLWithString: [stringURL stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];

check intermediate strings

Upvotes: 0

Related Questions