[quote='788684022, MobileTen, /thread/756036?answerId=788684022#788684022, /profile/MobileTen']
Then change link from an empty string to a valid URL string to prevent the URL init from returning nil.
[/quote]
The string starts as nil until the end user supplies one. I'm struggling to prevent fetching until the link is valid. Do you have a suggestion for what to put there for the init that won't **** up for the end user?
Post
Replies
Boosts
Views
Activity
Okay, I changed things up a little for testing.
Progress:
// BrowserViewController.m
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
@interface IABrowser : UIViewController {
UIWindow *window;
}
@property (nonatomic, strong) WKWebView *webView;
@end
@implementation IABrowser
- (void)viewDidLoad {
[super viewDidLoad];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
window = [[ UIApplication sharedApplication] keyWindow];
#pragma clang diagnostic pop
self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
[ [ [ window subviews ] objectAtIndex: 0 ] addSubview: self.webView];
// [self.view addSubview:self.webView];
NSLog(@"viewDidLoad");
}
- (void)loadURL:(NSString *)urlString {
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
NSLog(@"loadURL");
}
@end
When I click the button in the UI that should spawn this webView I get the log message that says 'loadURL' but nothing actually appears on screen. I know I'm missing something simple but I truly don't know what it is.