title: CKQueryNotification.recordID: unrecognized selector sent to instance
body: <p>I'm trying to set up silent push notifications to propagate local notifications across devices using CloudKit and I can't wrap my head around why my app is crashing every time I receive a remote notification. </p>
  
  <p>Everything works just fine until I try to process the notification received. The crash occurs when trying to access the recordID for the CKQueryNotification object inside didReceiveRemoteNotification. </p>
  
  <p>I'm registering for remote notifications inside application didFinishLaunchingWithOptions. And this is the rest of the code:</p>
  
  <p>Inside didRegisterForRemoteNotification, I'm creating a CKSubscription for the record type CD_Task.</p>
  
  <pre><code>   func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  
          let subscription = CKQuerySubscription(recordType: "CD_Task", predicate: NSPredicate(format: "TRUEPREDICATE"), options: .firesOnRecordCreation)
  
          let info = CKSubscription.NotificationInfo()            
          subscription.notificationInfo = info
  
          CKContainer.default().privateCloudDatabase.save(subscription, completionHandler: { subscription, error in
              if error == nil {
                  // Subscription saved successfully
              } else {
                  // Error occurred, handle it
              }
          })
      }
  </code></pre>
  
  <p>Inside DidReceiveRemoteNotification, I pass in a CKQueryNotification object to a function to handle the remote notification received from iCloud:</p>
  
  <pre><code>   func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {
          if let ckqn = CKQueryNotification(fromRemoteNotificationDictionary: userInfo as! [String:NSObject]) {
              self.iCloudHandleNotification(ckqn)
          }
      }
  </code></pre>
  
  <p>Finally, here is the iCloudHandleNotification function code:</p>
  
  <pre><code>        func iCloudHandleNotification(_ ckqn: CKQueryNotification) {
                      switch ckqn.queryNotificationReason {
                      case .recordCreated:
                          // This is where it crashes.. when I try to access ckqn.recordID
                          CKContainer.default().privateCloudDatabase.fetch(withRecordID: ckqn.recordID!) { (record, error) in
                              if let record = record {
                                  // Handle creating local notif for record
                              } else if let error = error {
                                  print("Unable to retrieve record: \(error)")
                              }
                          }
                      default:
                          break
                   }
          }
  </code></pre>
  
  <h1>EDIT:</h1>
  
  <p>After investigating, it seems like I'm getting a CKDatabaseNotification instead of a CKQueryNotification -- How am I suppose to specify that I want a CKQueryNotification?</p>