Cannot create or modify field 'notif_num_subtitle_loc_args

My users started getting this error on production schema only, this happens when trying to create a subscription. I'm guessing this field is being used by CloudKit. Has this happened to anyone else ?


This is how I'm creating it.

[self createQuerySubscriptionWithRecordType:@"Alarm" predicate:[NSPredicate predicateWithValue:true] subscriptionID:@"AlarmSubsription" database:self.cloudContainer.privateCloudDat:returnBlock];


-(void)createQuerySubscriptionWithRecordType:(NSString *)recordType predicate:(NSPredicate *)predicate subscriptionID:(NSString *)subscriptionID database:(CKDatabase *)database returnBlock:(void(^)(CKSubscription *subscription, NSError *error))returnBlock{
    CKSubscription *newSubscription = [[CKSubscription alloc]initWithRecordType:recordType predicate:predicate subscriptionID:subscriptionID options:(CKSubscriptionOptionsFiresOnRecordCreation | CKSubscriptionOptionsFiresOnRecordDeletion | CKSubscriptionOptionsFiresOnRecordUpdate)];
  
    CKNotificationInfo *notificationInfo = [CKNotificationInfo new];
    notificationInfo.shouldBadge = false;
    notificationInfo.alertBody = @"";
    notificationInfo.alertLocalizationKey = @"";
    notificationInfo.shouldSendContentAvailable = true;
    newSubscription.notificationInfo = notificationInfo;
  
    CKModifySubscriptionsOperation *modifyOperation = [[CKModifySubscriptionsOperation alloc]initWithSubscriptionsToSave:@[newSubscription] subscriptionIDsToDelete:nil];
  
    [modifyOperation setModifySubscriptionsCompletionBlock:^(NSArray *savedSubscriptions, NSArray *deletedSubscriptionsID, NSError *error) {
        if (error) {
            error = [CloudKitSync errorForKey:subscriptionID inPartialFailureError:error];
            returnBlock(nil, error);
        }
        else{
            NSAssert([savedSubscriptions containsObject:newSubscription], @"should contain freshly created subscription");
            returnBlock(savedSubscriptions[0],nil);
        }
    }];
    [database addOperation:modifyOperation];
  
}

Replies

The same error is happening to my app - it is stopping any new user from creating a subscription at this point. Would really appreciate a solution! 😕

FWIW, here is my code for setting up the CKModifySubscriptionsOperation:


        let subscriptionID = "MindscopeDownload"
        let predicate = NSPredicate(format: "TRUEPREDICATE")
        let options: CKSubscriptionOptions = [.firesOnRecordCreation, .firesOnRecordUpdate, .firesOnRecordDeletion]
        let subscription = CKSubscription(recordType: "MindscopeNode", predicate: predicate, subscriptionID: subscriptionID, options: options)
        let info = CKNotificationInfo()
        info.alertLocalizationKey = "Mindscope entry changes"
        info.shouldSendContentAvailable = true
        subscription.notificationInfo = info
        let op = CKModifySubscriptionsOperation(subscriptionsToSave: [subscription], subscriptionIDsToDelete: [])
        op.modifySubscriptionsCompletionBlock = { (foo, bar, error: Error?) -> () in
            if let e = error {
                print("Failed to modify subscription: \(e)

It looks like you're creating a CKSubscription directly, which has been deprecated. You should be using CKQuerySubscription instead.


Also note that subscriptions first have to be created in development and then deployed to production. As the documentation states, it's an error to try to create a new subscription in the production environment.

Getting the same error with this code:

let subscription = CKQuerySubscription(recordType: "Episode", predicate: NSPredicate(format: "feed IN %@", references), subscriptionID: "NewEpisodeSubscription", options: .firesOnRecordCreation)
subscription.notificationInfo = CKNotificationInfo()
subscription.notificationInfo?.category = "CKEpisode"
subscription.notificationInfo?.shouldSendContentAvailable = true

Thanks so much for the reply, this is helpful. A couple of follow-up questions to clarify:


  • CKQuerySubscription is iOS 10 or newer - what should we use if our app needs iOS 9 compatibility? Does CloudKit no longer work for subscriptions under iOS 9??
  • If we see the "subscription type" we need for our subscription in the CloudKit Dashboard in the "Production" environment, can we safely assume the subscription type was correctly created first in Development and moved to Production and can therefore be accessed without error?

I'm also seeing this. Like others have reported, it was all working fine, cheerfully creating CKQuerySubscriptions. Then one day it wasn't. It began sometime between April 1 and April 17, while I was out of the office and obviously not making changes to my code. My bug 31778923 has been closed as a dup, and the dup bug 31749495 is still open.


I have found two work arounds, both of which have limitations:


1. Create a new container, re-create the subscription types in the dev environment, deploy to production. Subscription creation works again, but you're starting over with an empty container, unless you migrate records.


2. In the original container, in the dev environment, delete all of the subscription types in the dashboard. Recreate the subscription types in your app, then push the changes to the prod environment. Subscription creation will work again. However, all existing subscriptions for the deleted sub types are now gone. If you're able to reconstruct the list of subscriptions for each user, then this might be viable. But, if your users had dynamically chosen things that created subscriptions, those will be gone unless you fetch existing subs, save the predicates, and then recreate them after you re-deploy the prod environment.


Note that I also tried creating new sub types with the same predicates but different subscription IDs. that failed, complaing that the new subs were duplicates. You could potentially add additional clauses to your predicates to create an entirely new subscription type... I didn't try that.

This solution worked for me. I didn't even need to push the development subscriptons to production, I think just deleting the subscriptions in dev and then recreating them in the simulator was all that was needed. Great advice, thanks!

That's good info. I would not have guessed that making the change in dev would solve the problem without promoting the changes to prod. If/when the problem happens again, I'll try just modifiying the dev env. Thanks!

But doesn't each user create their own subscription?