title: iOS How to open pdf, not from NSBundle
body: <p>I have an app where I need to annotate a pdf.  I have been using code from <a href="https://stackoverflow.com/questions/1333710/how-to-edit-a-pdf-in-objective-c">how to edit a PDF in objective-c?</a> and it's great, except the file location part.  I was getting the pdf from using </p>
  
  <pre><code>NSString *newFilePath = [[NSBundle mainBundle] pathForResource:@"Untitled_4" ofType:@"pdf"];
  </code></pre>
  
  <p>This was working in the Simulator, but will not work on my testing iPad.</p>
  
  <p>I was getting this error:</p>
  
  <pre><code>CGDataConsumerCreateWithFilename: failed to open 'long boring file path' for writing: Operation not permitted.
  </code></pre>
  
  <p>I also played around with </p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  NSString *newFilePath = [documentsDirectory stringByAppendingPathComponent:@"Untitled_4.pdf"];
  </code></pre>
  
  <p>I now understand that "You are not allowed to write to the application bundle." Thanks <a href="https://stackoverflow.com/questions/5600269/the-operation-couldnt-be-completed-operation-not-permitted">The operation couldn’t be completed. Operation not permitted</a></p>
  
  <p>When I later try to open the new annotated pdf it does not open correctly.</p>
  
  <p>Any help would be greatly appreciated. You guys rock!</p>
  
  <p>Hopefully this will help everyone else who needs help with pdf annotations in iOS.</p>