title: How to properly send an image to CloudKit as CKAsset?
body: <p>I have an image (UIImage and it's url too) and I'm trying to send it to CloudKit as a CKAsset but I'm having this error: <code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Non-file URL'</code>. Here is the code:</p>
  
  <pre><code>override func viewDidLoad() {
          super.viewDidLoad()
  
          send2Cloud()
      }
  
  func send2Cloud() {
      let newUser = CKRecord(recordType: "User")
  
      let url = NSURL(string: self.photoURL)
  
      let asset = CKAsset(fileURL: url!)
  
      newUser["name"] = self.name
      newUser["photo"] = asset
  
      let publicData = CKContainer.defaultContainer().publicCloudDatabase
  
      publicData.saveRecord(newUser, completionHandler: { (record: CKRecord?, error: NSError?) in
  
          if error == nil {
  
              dispatch_async(dispatch_get_main_queue(), { () -&gt; Void in
                  print("User saved")
              })
  
          } else {
              print(error?.localizedDescription)
          }
      })
  }
  </code></pre>
  
  <p>I have the URL, I can print it, copy and paste to my navigator and it will show my image! So, I don't know what is happening here...</p>
  
  <p>It would be easier if I worked with an UIImage instead of it's URL? Because, as I sais before, I have both of them! Any help is very appreciated! Thanks, guys!!</p>