ビルド中のアプリケーションがあり、Cloudkitを使用したサブスクリプションを追跡しようとしています。私は、NotificationTextと呼ばれるタイプのStringの1つのフィールドを持つNotificationsというRecordTypeを持っています。何らかの理由で、私が新しいレコードを追加すると、アプリケーションはそれを受け取らない。これまで私が行ってきたことは次のとおりです。目的C-Push通知がCloudkitと連携していない
- アプリの「機能」セクションにクラウドキットに登録されています。
- 追加使用してデータベースへのサブスクリプションを保存したリモート通知
のためのInfo.plistファイルに必要なバックグラウンドモードキー:使用してプッシュ通知を送信するために、ユーザからの
CKSubscription *subscription = [[CKSubscription alloc] initWithRecordType:@"Notifications" predicate:[NSPredicate predicateWithValue:YES] options:CKSubscriptionOptionsFiresOnRecordCreation]; CKNotificationInfo *notificationInfo = [CKNotificationInfo new]; notificationInfo.alertLocalizationKey = @"NotificationText"; notificationInfo.shouldBadge = YES; notificationInfo.soundName = @""; subscription.notificationInfo = notificationInfo; [publicDB saveSubscription:subscription completionHandler:^(CKSubscription *subscription, NSError *error) { if (error) [self handleError:error]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"sub"]; } ];
要求の許可:
UIApplication *application = [UIApplication sharedApplication]; UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil]; [application registerUserNotificationSettings:notificationSettings]; [application registerForRemoteNotifications];
AppDelegate.mファイルで
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(non null NSDictionary *)userInfo fetchCompletionHandler:(non null void (^)(UIBackgroundFetchResult))completionHandler;
実装されています。
私はCloudkit Dashboardに入り、RecordType Notificationsの新しいレコードを作成しますが、何も起こりません。私は何か間違っているのですか?何か不足していますか?