我是 iphone 新手,我正在尝试在 UIWebView 中打开 .docx 文件
我使用了这段代码:
NSString *urlAddress = [[NSBundle mainBundle] pathForResource:docName
ofType:@"docx"];
NSLog(@"the document url address: %@", urlAddress);
NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_webView loadRequest:requestObj];
还有这段代码:
NSData *myData = [NSData dataWithContentsOfFile:docName];
[_webView loadData:myData MIMEType:@"application/vnd.ms-word"
textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
我确定资源文件夹中的文件,但是在运行时它给了我一个异常并在 main.m 中说
int main(int argc, char *argv[])
{
@autoreleasepool {
// here it tells me that (Thread 1: signal SIGKILL)
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MFAppDelegate class]));
}
}
有什么帮助吗??