我在打開我的應用程序時打開Google的AppDelegate.m文件中有以下代碼。我試圖改變它打開一個.HTML網頁,我複製到我的Xcode項目,但它不工作。我正在使用Xcode 4.5.2。OS X Web視圖應用程序 - 不會加載本地.html網頁
,致力於打開谷歌的代碼是:
@implementation MDAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]];
[self.webView.mainFrame loadRequest:request];
}
我試圖將其更改爲(以便它會載入我的test.html文件,我把項目文件夾,但應用程序只是出現空白現)。我錯過了什麼?
@implementation MDAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"test.html"]];
[self.webView.mainFrame loadRequest:request];
}
這對我有用。謝謝! – user1822824 2013-02-12 03:21:28
@ user1822824很高興幫助! ;-) – 2013-02-12 03:34:57
有沒有簡單的方法來啓用Web視圖的本地存儲? – user1822824 2013-02-15 00:27:19