代码来打开iphone webView中的.docx

我是iPhone新手,我试图在UIwebView中打开.docx文件,我写了下面的代码

NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"Arabic literature" ofType:@"docx"]; NSURL *url = [NSURL fileURLWithPath:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; NSData *data = [NSData dataWithContentsOfFile:urlAddress]; //[_webView loadRequest:requestObj]; [_webView loadData:data MIMEType:@"application/vnd.ms-word" textEncodingName:@"UTF-8" baseURL:nil]; 

但它给了我以下例外:

 DiskImageCache: Could not resolve the absolute path of the old directory. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter' 

考虑到我在支持文件中复制了“Arabic literature.docx”文件。 我怎么能解决这个exception?

好吧,你为什么不使用这样的东西:

  NSURLRequest *request = [NSURLRequest requestWithURL:url]; [_webView loadRequest:request]; 

抱歉的意见不起作用,所以不得不作为答案。