0
我正在尝试为Objective-C中的iOS设置动态CKNotification
,但它无法注册通知。我的动态CKNotification将不会注册
这里是我的代码:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"notify == %@",userentry2.text];
CKSubscription *newRecordSub = [[CKSubscription alloc] initWithRecordType:savefolder predicate:predicate options: CKSubscriptionOptionsFiresOnRecordUpdate | CKSubscriptionOptionsFiresOnRecordCreation];
CKNotificationInfo *noteInfo = [CKNotificationInfo new];
[email protected]"%@";
noteInfo.alertLocalizationArgs = [NSArray arrayWithObject:@"message"];
noteInfo.shouldBadge = NO;
noteInfo.soundName = UILocalNotificationDefaultSoundName;
newRecordSub.notificationInfo = noteInfo;
CKContainer *container = [CKContainer defaultContainer];
CKDatabase *publicDatabase = [container publicCloudDatabase];
[publicDatabase saveSubscription:newRecordSub completionHandler:^(CKSubscription *subscription, NSError *error) {
if(error){
NSLog(@"didn't register new notif");
}
else{
NSLog(@"registered new notif");
}
}];
当我刚刚警报正文之前,没有alertLocalizationArgs
,那就完全注册,但现在,我已经添加了alertLocalizationArgs
功能,它不会注册。
任何想法?
非常感谢,抱歉,我应该指定:“消息”将是ckrecord中的关键字段或字段。 –