2

私はCKSubscriptionこのように使用しようとしています:

NSArray *events = @[@1,@2,@3];
NSInteger myValue = 100;

NSPredicate *predicate = [NSPredicate predicateWithFormat:
    @"(value > %@) AND (prev_value < %@) AND (event_type IN %@)",
    @(myValue), @(myValue), events];

CKSubscription *sub = [[CKSubscription alloc] initWithRecordType:@"TableName"
    predicate:predicate options:(CKSubscriptionOptionsFiresOnRecordCreation)];

[db saveSubscription:sub completionHandler:^(CKSubscription *s, NSError *error) {
    if (error) {
        NSLog(@"Error: %@", error.localizedDescription);
        return;
    }
    NSLog(@"Success!");
}];

これでエラーが発生します:

Error: Error saving record subscription with id 781FB482-C9C9-4DA5-8022-CFDB8006223A to server:
invalid attempt to set value type NUMBER_INT64 for field 'binding_0' for type
'_sub_trigger_sub_220b17724b5262b0590a3c9d66be9826', defined to be: INT64_LIST

これは、有効なオブジェクトNSPredicateの一部として CloudKit に適切に格納できないようですCKSubscription。それは本当のAppleのバグですか、それとも私のものですか?

PS述語条件のさまざまな部分を削除して、さまざまな組み合わせを試しました。正常に動作する唯一の条件のように見えevent_typeますが、3 つの条件を混在さANDせると、問題が発生します。

私がiPhone 5Sで使用Xcode 6 beta 6してOSX 10.10 DP6いるPPSiOS8 beta 5

アップデート:

次のいずれかの述語を含むサブスクリプションは正常に機能します。

NSPredicate *predicate1 = [NSPredicate predicateWithFormat:
    @"(value > %@) AND (prev_value < %@)", @(myValue), @(myValue)];

NSPredicate *predicate2 = [NSPredicate predicateWithFormat:
    @"(event_type IN %@)", events];

ただし、共通の述語でサブスクリプションを保存すると失敗します。

NSPredicate *predicate = [NSPredicate predicateWithFormat:
    @"(value > %@) AND (prev_value < %@) AND (event_type IN %@)",
    @(myValue), @(myValue), events];

実際の Apple CloudKit のバグのようです。bugreport.apple.com で問題をオープンしました #18105879

更新 2:

@purrrminator に感謝 - CloudKit プッシュ通知の受信に問題がある 2 つのレーダーを次に示します。

http://openradar.appspot.com/18807663

http://openradar.appspot.com/18798061

多くの等値比較子を使用して条件CKSubscriptionを提示することにより、適切に保存するための回避策を見つけました。INしかし、本当にCLoudKitからのプッシュ通知はありません...

4

1 に答える 1