0

I am new in iOS and when I open PDF in UIWebView I am getting warning like this in console.

void SendDelegateMessage(NSInvocation *): delegate (webView:didFirstLayoutInFrame:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

2017-07-11 16:55:38.304119+0530 appname[1334:540218] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)

Here is the code below to open a PDF file on Webview from NSBundle

    visionweb.delegate=self;

NSURL *targetURL = [[NSBundle mainBundle] URLForResource:@"a0" withExtension:@"pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];

[visionweb loadRequest:request];

[self.view addSubview:visionweb];

Here visionweb is my UIWebview object.

I tried to open other PDF file using same code and was able to open them. But When I try to open this particular file, it shows the above message on console.

Both the delegate methods

  1. - (void)webViewDidStartLoad:(UIWebView *)webView; and
  2. - (void)webViewDidFinishLoad:(UIWebView *)webView;

gets called when I try to open another PDF file.

But when I try to open that particular PDf file , it only calls the first delegate method, that is only -(void)webViewDidStartLoad:(UIWebView *)webView; gets called, and not the other one.

I am not able to understand the problem behind it. I have searched it on internet and found so many people facing this same issue, but their solution did not helped me. I am using Xcode 6.2.

halfer
  • 19,824
  • 17
  • 99
  • 186
Muju
  • 884
  • 20
  • 54

1 Answers1

0

Here is a solution. I have used below code and it's working for me.

termsWebView.delegate = self;
NSString *path = [[NSBundle mainBundle] 
pathForResource:@"Terms_of_Use_20170523" ofType:@"docx"];

NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[termsWebView loadRequest:request];
  • @Jignesh-Yes. I too used the same code and its working for other files, but when i try to open this file -> "a0.pdf", it gives me the above warning in console. Is there any other way to load pdf on webview, or other way to detect whether the contents of that pdf files are correct or not. Please help me out. – Muju Jul 21 '17 at 12:41
  • NSData *WebData=[NSData dataWithContentsOfURL:soundURL]; [_webView loadData:WebData MIMEType:@"application/pdf" textEncodingName:@"UTF-8" baseURL:nil]; Try this! – Jignesh Radadiya Jul 21 '17 at 12:59
  • No not help to me. – Muju Jul 22 '17 at 05:57
  • @Jignesh-Can you please help me out on my other issue on localization? I would really appreciate it. Please help me. – Muju Jul 25 '17 at 06:45
  • Yes, Sure have you posted that issue here? – Jignesh Radadiya Jul 26 '17 at 08:33