title: How to create a share with CloudKit's CKShare?
body: <p>I'm studying the new <code>CKShare</code> that Apple released this year and I have some questions with it. I was trying to follow the WWDC's "What's new in CloudKit" video but part of the code isn't working anymore in Xcode.</p>
  
  <p>What I'm trying to do is: the user will enter his name and phone and after clicking a <code>UIButton</code>, will share with a specific person. Here is the code:</p>
  
  <pre><code>class ViewController: UIViewController, UICloudSharingControllerDelegate {
      @IBOutlet weak var nome: UITextField!
      @IBOutlet weak var telefone: UITextField!
      @IBOutlet weak var button: UIButton!
  
      override func viewDidLoad() {
          super.viewDidLoad()
      }
  
      @IBAction func send(_ sender: AnyObject) {
          print("Send button was clicked.\n")
  
          let elder = CKRecord(recordType: "Elder")
          elder["name"] = self.name.text as CKRecordValue?
          elder["telephone"] = self.telephone.text as CKRecordValue?
  
          let ckContainer = CKContainer.default()
          let shareRecord = CKShare(rootRecord: elder)
  
          shareRecord[CKShareTitleKey] = "Elder" as CKRecordValue?
  
          let shareController = UICloudSharingController(share: shareRecord, container: ckContainer)
          shareController.delegate = self
          shareController.availablePermissions = [.allowReadOnly]
          shareController.popoverPresentationController?.sourceView = self.button
  
          self.present(shareController, animated: true)
      }
  
      func cloudSharingController(_ csc: UICloudSharingController, failedToSaveShareWithError error: Error) {
          print("PROBLEM SAVING SHARE")
      }
  
      func cloudSharingControllerDidSaveShare(_ csc: UICloudSharingController) {
          print("SHARE SAVED")
      }
  
      func itemTitle(for csc: UICloudSharingController) -&gt; String? {
          return "a"   //don't know what this is for
      }
  }
  </code></pre>
  
  <p>My app keeps printing "PROBLEM SAVING SHARE" even though the CloudSharingController appears. Also, the CKRecord <em>elder</em> isn't appearing in CloudKit's dashboard.</p>