Unsubscribing from a Bucket
You can unsubscribe from a bucket to stop receiving a push notification when a change occurs in the bucket.
Here is the sample code for unsubscribing from a bucket.
Swift:
-
// Instantiate the target bucket. let bucket = Kii.bucket(withName: "_target_bucket_") do{ // Unsubscribe from the bucket. try KiiUser.current()!.pushSubscription().unsubscribeSynchronous(bucket) } catch let error as NSError { // Handle the error. return }
-
// Instantiate the target bucket. let bucket = Kii.bucket(withName: "_target_bucket_") // Unsubscribe from the bucket. KiiUser.current()!.pushSubscription().unsubscribe(bucket, block: { (subscription : KiiPushSubscription, error : Error?) -> Void in if error != nil { // Handle the error. return } })
Objective-C:
-
NSError *error = nil; // Instantiate the target bucket. KiiBucket *bucket = [Kii bucketWithName:@"_target_bucket_"]; // Unsubscribe from the bucket. [[KiiUser currentUser].pushSubscription unsubscribeSynchronous:bucket error:&error]; if (error != nil) { // Handle the error. return; }
-
// Instantiate the target bucket. KiiBucket *bucket = [Kii bucketWithName:@"_target_bucket_"]; // Unsubscribe from the bucket. [[KiiUser currentUser].pushSubscription unsubscribe:bucket block:^(KiiPushSubscription *subscription, NSError *error) { if (error != nil) { // Handle the error. return; } }];
For more information, refer to the appledoc.