Getting application crash during opening a local pdf file on UIWebView

- (void) viewWillAppear:(BOOL)animated

 [super viewWillAppear:animated];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"About" ofType: @"pdf"];

    NSLog(@"%@", path);

    NSURL *targetURL = [NSURL fileURLWithPath:path];

    NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];

    [_webView loadRequest:request];



just use following code for open PDF in web view

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"About" ofType:@"pdf"]; 
[self.webVctr loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];

And check it out the PDF is exist or not?

This thinks may helping to you

Happy codeing..

Try this:

in the

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];

NSString *path = [[NSBundle mainBundle] pathForResource:@"About" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];

[self.view addSubview:webView];
[webView release];

It was some other issue not related to the pdf loading over web view. I cross checked and found the actual cause of crash. Anyways thanks guys for the help

Need Your Help

Android - show animation atleast a few second

android animation android-sqlite android-animation

I have Button which function is to animate one of my ImageView for a second and delete specific table, recreate and insert the default value. Everything's working fine but one of my requirements is...

How to get facebook friends emails

ruby ruby-on-rails-3 facebook-graph-api koala omnicontacts-gem

I am working on ruby on rails application and here I need Facebook friends email ID's