title: Core Data Failing on saveToURL on UIManagedDocument
body: <p>I'm trying to set up core data but when i'm running <code>saveToURL</code> on the <code>UIManagedDocument</code> it's failing to create it. This is my code;</p>
  
  <pre><code>@property (nonatomic, strong) UIManagedDocument *currentUserDatabase;
  
  @synthesize currentUserDatabase = _currentUserDatabase;
  
  - (void)setCurrentUserDatabase:(UIManagedDocument *)currentUserDatabase
  {
      _currentUserDatabase = currentUserDatabase;
      [self useDocument];
  } 
  
  
  - (void)isUserLoggedIn
  {
      if (!self.currentUserDatabase) {
          NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentationDirectory inDomains:NSUserDomainMask] lastObject];
          url = [url URLByAppendingPathComponent:@"Current User Database"];
          self.currentUserDatabase = [[UIManagedDocument alloc] initWithFileURL:url];
      }
  }
  
  - (void)useDocument
  {
      if (![[NSFileManager defaultManager] fileExistsAtPath:[self.currentUserDatabase.fileURL path]]) {
          [self.currentUserDatabase saveToURL:self.currentUserDatabase.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
              if (success) {
                  NSLog(@"create success");
              } else {
                  NSLog(@"create failed");
              }
              //[self getCurrentUser];
          }];
      } else if (self.currentUserDatabase.documentState == UIDocumentStateClosed) {
          [self.currentUserDatabase openWithCompletionHandler:^(BOOL success) {
              //[self getCurrentUser];
          }];
      } else if (self.currentUserDatabase.documentState == UIDocumentStateNormal) {
          //[self getCurrentUser];
      }
  }
  </code></pre>
  
  <p><code>isUserLoggedIn</code> gets called first, but when it gets created, I get the log "create failed" - I don't understand because there is no errors. Are there any ways to get error messages? Anyone know why it's not working?</p>