ios - CloudKit: query subscriptions request -
i'm working in app using cloudkit , i'm creating subscription cloudkit. here code:
cksubscription *subscription = [[cksubscription alloc] initwithrecordtype:recordtype predicate:predicate options:cksubscriptionoptionsfiresonrecordcreation | cksubscriptionoptionsfiresonrecordupdate | cksubscriptionoptionsfiresonrecorddeletion]; cknotificationinfo *notificationinfo = [cknotificationinfo new]; notificationinfo.shouldsendcontentavailable = yes; subscription.notificationinfo = notificationinfo; notificationinfo.shouldbadge = yes; ckdatabase *publicdatabase = [container publicclouddatabase]; [publicdatabase savesubscription:subscription completionhandler:^(cksubscription *subscription, nserror *error) { if (!error) { nslog(@"subscription success!"); } else { nslog(@"subscription error%@", error.localizeddescription); } }];
my question guys. how can query or validate user subscription cloudkit ?
a subscription nothing more ckpredicate active on server side instead of in app. if want validate if predicate correct, execute query , see back.
make sure application diffinishlaunchingwithoptions has following lines of code:
application.registerusernotificationsettings(uiusernotificationsettings(fortypes: .alert | .badge | .sound, categories: nil)) application.registerforremotenotifications()
also make sure handle incoming notifications adding this:
func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject]) { nslog("push received.. should handled..") }
Comments
Post a Comment