title: UIWebView loadrequest throwing EXC_BAD_ACCESS code=1
body: <p>So i have been using sqlite3 and blob which has pdf in it. I read it from db and after loading 2 request i get error in simulator.</p>
  
  <p>ViewController.m</p>
  
  <pre><code>
  
      #import 
  
      @interface ViewController : UIViewController {
          NSMutableArray *lights;
      }
  
      @property (nonatomic, retain) NSMutableArray *lights;
      @property (weak, nonatomic) IBOutlet UILabel *lightname;
      @property (weak, nonatomic) IBOutlet UILabel *lighttype;
      @property (weak, nonatomic) IBOutlet UIImageView *lightmainimage;
      @property (weak, nonatomic) IBOutlet UIWebView *lightwebview;
  
      @property (weak, nonatomic) NSURLRequest *req;
      @property (weak, nonatomic) NSURL *targetURL;
      @property (strong, nonatomic) NSString *appFile;
      @property (weak, nonatomic) NSArray *paths;
      @property (weak, nonatomic) NSString *documentsDirectory;
  
      - (IBAction)GetLightListing:(id)sender;
  
      @end
  
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>
  
      #import "ViewController.h"
      #import "LightsList.h"
      #import "MyLightsList.h"
  
      @interface ViewController ()
      @end
  
      @implementation ViewController
  
      @synthesize lightname;
      @synthesize lighttype;
      @synthesize lightmainimage;
      @synthesize lights;
      @synthesize req;
      @synthesize targetURL;
      @synthesize appFile;
      @synthesize paths;
      @synthesize documentsDirectory;
  
      - (void)viewDidLoad
      {
          [super viewDidLoad];
          // Do any additional setup after loading the view, typically from a nib.
          MyLightsList *mylights = [[MyLightsList alloc] init];
          self.lights = [mylights getMyLights];
          [self.lightmainimage setImage:((LightsList *) [self.lights objectAtIndex:0]).lightMainImage];
          [self.lighttype setText:((LightsList *) [self.lights objectAtIndex:0]).lightType];
          [self.lightname setText:((LightsList *) [self.lights objectAtIndex:0]).lightName];
          self.paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
          self.documentsDirectory = [self.paths objectAtIndex:0];
          NSError *error;
          self.documentsDirectory = [self.paths objectAtIndex:0];
          self.appFile = [self.documentsDirectory stringByAppendingPathComponent:@"datasheet.pdf"];
          if([((LightsList *)[self.lights objectAtIndex:0]).lightDatasheetPDF writeToFile:self.appFile options:NSDataWritingAtomic error:&error]) {
              NSLog(@"file suceed!");
          } else NSLog(@"file fail! %@",error);
          self.targetURL = [NSURL fileURLWithPath:self.appFile];
          self.req = [NSURLRequest requestWithURL:self.targetURL];
          [self.lightwebview loadRequest:self.req];
      }
  
      - (void)didReceiveMemoryWarning
      {
          [super didReceiveMemoryWarning];
          // Dispose of any resources that can be recreated.
      }
  
      - (IBAction)GetLightListing:(id)sender {
          static NSInteger currentIndex = 0;
          if(++currentIndex == [self.lights count]) {
              currentIndex = 0;
          } else {
              LightsList *aLight = (LightsList *) [self.lights objectAtIndex:currentIndex];
              [self.lightmainimage setImage:aLight.lightMainImage];
              [self.lighttype setText:aLight.lightType];
              [self.lightname setText:aLight.lightName];
              NSError *error;
              if([aLight.lightDatasheetPDF writeToFile:self.appFile options:NSDataWritingAtomic error:&error]) {
                  NSLog(@"file suceed!");
              } else NSLog(@"file fail! %@",error);
              self.targetURL = [NSURL fileURLWithPath:self.appFile];
              self.req = [NSURLRequest requestWithURL:self.targetURL];
              [self.lightwebview loadRequest:self.req];
          }
      }
      @end
  
  </code></pre>
  
  <p>I'm sure the error is thrown on [self.lightwebview loadRequest:self.req]; because if i use stoploading after it, error wont happen or if i comment that line, but i really have no clue whats the problem here...</p>