title: Error Handling When Saving a CKRecord
body: <p>I am looking for an example of proper error handling when saving a <code>CKRecord</code>. According to the <a href="https://developer.apple.com/library/prerelease/ios/documentation/CloudKit/Reference/CKRecord_class/index.html" rel="nofollow">Apple docs</a> I should "Use the information in the error object to determine whether a problem has a workaround."</p>
  
  <p>I understand that the error object has a <code>userInfo</code> dictionary, but how do I figure out what the keys are for the dictionary and how to handle the errors?</p>
  
  <p>The following example illustrates how I'm currently saving a <code>CKRecord</code>:</p>
  
  <pre><code>    CKRecord *record = [[CKRecord alloc] initWithRecordType:@"MyRecordType"];
  [record setValue:[NSNumber numberWithInt:99] forKey:@"myInt"];
  
  [db saveRecord:record completionHandler:^(CKRecord *savedPlace, NSError *error) {
      // handle errors here
      if (savedPlace) {
          NSLog(@"save successful");
      }else{
          NSLog(@"save unsuccessful");
      }
      if (error) {
          NSLog(@"Error saving %@", error.localizedDescription);
      }
  
  }];
  </code></pre>
  
  <p>How can I improve this code to provide work arounds for potential saving issues?</p>