2013-04-28 54 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