1 Reply
      Latest reply on Nov 10, 2018 5:05 PM by PBK
      PBK Level 6 Level 6 (2,785 points)

        I have a basic misunderstanding of something.

        I want each user to be able to switch on, or switch off, a subscription* which will notify them when new records are added to the public database.  Because they can turn this on or off, each user must have their own unique subscription and they do a:

               CKModifySubscriptionsOperation *modifySubscriptions=
                    [[CKModifySubscriptionsOperation alloc] initWithSubscriptionsToSave:subscriptionToAdd 
                             subscriptionIDsToDelete:subscriptionIDsToDelete];
        

         

        with the subscription in subscriptionsToAdd or subscriptionIDsToDelete.

         

        If I used identical subscriptions for each user then when one user deleted it it would be deleted for all users.

         

        So....

        1) this means that if I have 20,000 users I will have 20,000 subscriptions*  - IS THAT THE CORRECT PROCEDURE????

        and

        2) I am violating this provision:      IS IT OK TO IGNORE THIS??????

           "Subscriptions must be created in the Development environment first and then promoted to Production. Attempting to create a subscription directly in the Production environment will result in an error." 

                  https://developer.apple.com/documentation/cloudkit/cksubscription?language=objc

         

        * actually I have 5 different recordTypes.  The user gets to select, from amongst the 5, which ones they want to turn on/off.  So the problem is 100,000 subscriptions and cannot be 'solved' by enabling or disabling all notifications for the device.

                        NSString *subID=[anAlert stringByAppendingString:
                                [[[[UIDevice currentDevice] identifierForVendor] UUIDString] substringFromIndex:4]];
                        CKQuerySubscription *itemSubscription=[[CKQuerySubscription alloc] 
                                initWithRecordType:recordType predicate:predicate subscriptionID:subID 
                                options:CKQuerySubscriptionOptionsFiresOnRecordCreation];   
                        itemSubscription.notificationInfo = notification;
                        [subscriptionToAdd addObject:itemSubscription];
        

         

        .