Subscription Question

I want to solve following situation to subscriptions.

I have a public database where all data of users gets in when they are using my CloudKit option in my App.

In this public database all Records having a unique ID representing the user.


Now i try to make subscriptions to some user ID's but i am only able to subscribe one time to the same subscription option.

What i want is that my App can subscribe to several ID's

Like App1 => subscribe to changes at all records of ID1

and also App1 => subscribe to changes at all records of ID2 etc.


Here is my function when subscribing.

/*
     **Subscribes to CloudKit Record changes**
  
     - parameter recordType: - String: *Name of the Record as String (equal to a table name)*
     - parameter predikateKey: - String: *Name of the Key for subscription (equal to column name)*
     - parameter predicate: - String: *Predicate to filter subscriptions (equal to cell value)*
     - parameter subscriptionOptions: - CKSubscriptionOptions: *Options when the subscription shoulc fire*
     - parameter alertBody: - String: *The Push Notification Message*
  
     - remark:
     Subscribes to changes of records in CloudKit Services.
     In this app all subscriptions should be filtered by predikateKey: id and predicate equal to the userId the app are subscribed to.
     */
    func subscribeToCloudKitChanges(recordType:String, predicateKey:String, predicate:String, subscriptionOption:CKSubscriptionOptions, alertBody:String) {
     
        let predicate = NSPredicate(format: "\(predicateKey) = %@", predicate)
        let subscription = CKSubscription(recordType: recordType, predicate: predicate, options: subscriptionOption)
     
        let notificationInfo = CKNotificationInfo()
        notificationInfo.alertBody = alertBody
        notificationInfo.shouldBadge = false
        notificationInfo.soundName = UILocalNotificationDefaultSoundName
     
        subscription.notificationInfo = notificationInfo
     
        publicDB!.saveSubscription(subscription, completionHandler: ({returnRecord, error in
            if let err = error {
                let title:String = eLocalization.Alert_CloudKit_Subscription_Error_Title.rawValue.localized
                let message:String = err.localizedDescription
                let dict:Dictionary<String,String> = ["Title": title, "Message": message]
                print(err.localizedDescription)
                NSNotificationCenter.defaultCenter().postNotificationName(eNSNotifications.CKmngr_SendCloudKitSubscriptionMessage.rawValue, object: dict )
            }
            else {  dispatch_async(dispatch_get_main_queue()) {
                print("CloudKit subscription success")
                let title:String = eLocalization.Alert_CloudKit_Subscription_Success_Header.rawValue.localized
                let message:String = eLocalization.Alert_CloudKit_Subscription_Success_Message.rawValue.localized + " \(predicate)"
                let dict:Dictionary<String,String> = ["Title": title, "Message": message]
                NSNotificationCenter.defaultCenter().postNotificationName(eNSNotifications.CKmngr_SendCloudKitSubscriptionMessage.rawValue, object: dict )
                }
            }
        }))
    }


getting a error message

Error saving record subscription with id D4ECD34D-6089-46B6-8C1B-86A97B282869 to server: did not find required record type: _sub_trigger_sub_a12e9e5b99ff6d2f948c03b7629b73dd

Howdy,


I'm seeing this same issue, in my case with an app that's been working fine with subscriptions for awhile.


My development environment subscriptions work but both TestFlight and App Store versions do not - they fail with the same error above about the record type not being able to be found.

Have you been able to make any progress? I'm probably going to open a DTS ticket here next.


Hunter

Subscription Question
 
 
Q