Create a new subscription in the development environment

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];


.

Answered by PBK in 339313022

I think I figured this one out.


For the record - there are subscriptions and "subscription types". What Apple meant to write in

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

is:

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


And since each user will have a "subscription" tied to a "subscription type" the idea of having 20,000 subscriptions in a database is not that bad since there will still be only a few "subscription types".

Accepted Answer

I think I figured this one out.


For the record - there are subscriptions and "subscription types". What Apple meant to write in

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

is:

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


And since each user will have a "subscription" tied to a "subscription type" the idea of having 20,000 subscriptions in a database is not that bad since there will still be only a few "subscription types".

Create a new subscription in the development environment
 
 
Q