I have a .xlsx file in the iOS application docs folder. I want to show this excel file in UIWebview. but I get below error,
Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted"
but the pdf and csv files open, I am new to iOS and have tried all possible things to work, I think the last 2 days. nothing worked .. please help me
Update: Even if I rename it as file.xls, it does not open below my code,
NSURL* nsUrl = [NSURL URLWithString:url];
_urlReq = [NSURL URLWithString:url];
[self performSelector:@selector(urlRequestForFile) withObject:nil afterDelay:0];
_webView.delegate = self;
NSURLRequest* request = [NSURLRequest requestWithURL: nsUrl];
[_webView loadRequest: request];
-(void)urlRequestForFile{
self.connection = nil;
NSURLRequest *requestForFile = [NSURLRequest requestWithURL:_urlReq cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:300];
_connection = [[NSURLConnection alloc]initWithRequest:requestForFile delegate:self startImmediately:YES];
_ongingServiceFlag = YES;
}
do I need help showing the xlsx file inside my IOS application using UIWebView or is there any other way to show the xlsx file inside the application without using third-party applications?
Update (Solution):
, , XLSX - Apple UIWebView, UIWebView XLSX. , "textEncodingName". base64, textEncodingName: @ "base64", "utf-8"
:
[webView loadData:urlData MIMEType:@"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" textEncodingName:@"base64" baseURL:nil];