title: How to email sqlite database of Iphone app from itself?
body: <p>In my current app I am adding a data backup and restore feature.
  User can create back up of database and can email it.
  In restore feature user can import the database from email and can replace the current.</p>
  
  <p>I am able to do create back up and restore of database file. 
  In restore I am just copying the file from my email to app Documents file replacing current one. 
  The problem is that in my code for backup of database, sqlite database is converted to NSData. I don't want to to be converted and need the exact sqlite file to be emailed.</p>
  
  <p>Here is the code that I currently use to email sqlite database</p>
  
  <pre><code>-(void)backUpData
  {
  
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  
  NSString *txtPath = [documentsDirectory stringByAppendingPathComponent:@"/DemoApp.sqlite"];
  
  NSURL *newUrl = [[NSURL alloc] initWithString:
  [txtPath stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
  
  NSData *sqliteData = [[NSData alloc] initWithContentsOfURL:newUrl];
  
  //send sqliteData to email composer delegate to attach it as attachment
  [self showPicker:sqliteData];
  
  }
  </code></pre>
  
  <p>How I can email sqlite db without converting it to NSData?</p>