2013-04-28 89 views
-3

我真的不知道Xcode的任何內容。Xcode uiwebView本地文件不起作用

我在ViewController.m這個代碼在一個UIWebView本地文件:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]]; 
} 

(我看到這個在教程YT:http://www.youtube.com/watch?v=1gmH5nuxrKk

但Xcode中說:

enter image description here

我該如何解決這個問題?

+0

「我真的不知道任何Xcode的。」 - 你不需要知道這件事,真的。閱讀您正在使用的API的文檔以及基本的Objective-C語言教程已足夠。 – 2013-04-28 17:01:32

+0

檢查你的大括號 – CodaFi 2013-04-28 17:12:27

+0

-1如果你必須寫「我真的不知道Xcode的任何內容」,那麼我認爲可以肯定地說你在提問之前沒有做過多的研究。 – Monolo 2013-04-28 17:23:07

回答

1

變化

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]]; 

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]]]]; 

編輯:我剛剛做,你可以下載和使用一個非常非常基本的和簡單的項目。

這是對bitbucket