KiiPushSubscription Class Reference
Inherits from | NSObject |
Declared in | KiiPushSubscription.h |
Overview
This class is responsible for the subscription of push notification.
Warning: Direct instatiations is prohibited, an exception will be thrown if [[KiiPushSubscription alloc] init] is called. KiiPushSubscription should be constructed from [KiiUser pushSubscription] or [KiiThing pushSubscription] .
Tasks
-
– subscribeSynchronous:error:
-
– unsubscribeSynchronous:error:
-
– checkIsSubscribedSynchronous:error:
-
– subscribe:block:
-
– unsubscribe:block:
-
– checkIsSubscribed:block:
-
+ subscribe:withBlock:
-
+ subscribe:withDelegate:andCallback:
-
+ subscribeSynchronous:withError:
-
+ unsubscribe:withBlock:
-
+ unsubscribe:withDelegate:andCallback:
-
+ unsubscribeSynchronous:withError:
-
+ checkSubscription:withBlock:
-
+ checkSubscriptionSynchronous:withError:
-
+ checkSubscription:withDelegate:andCallback:
Class Methods
checkSubscription:withBlock:
Asynchronously check whether subscribable object is already subscribed or not using block. This is a non-blocking method. (Deprecated: Use instance method instead.)
+ (void)checkSubscription:(id<KiiSubscribable>)subscribable withBlock:(KiiSubscribableBlock)completion
Parameters
- subscribable
A subscribable object. Currently, KiiBucket and KiiTopic can be checked for subscription.
- completion
block to handle after process completed
Discussion
Asynchronously check whether subscribable object is already subscribed or not using block. This is a non-blocking method.
[KiiPushSubscription checkSubscription:bucket withBlock:^(idKiiSubscribable subscribable, BOOL result, NSError *error) {
if (result) {
NSLog(@"subscribed");
}
}];
Declared In
KiiPushSubscription.h
checkSubscription:withDelegate:andCallback:
Asynchronously check whether subscribable object is already subscribed or not using delegate and callback. This is a non-blocking method. (Deprecated: Use instance method instead.)
+ (void)checkSubscription:(id<KiiSubscribable>)subscribable withDelegate:(id)delegate andCallback:(SEL)callback
Parameters
- subscribable
A subscribable object. Currently, KiiBucket and KiiTopic can be checked for subscription.
- delegate
The object to make any callback requests to.
- callback
The callback method to be called when the request is completed. The callback method should have a signature similar to:
- (void)subscribableObject:(idKiiSubscribable) subscribable isSubscribed:(BOOL) isSubscribed withError:(NSError*)error { // check whether the request was successful if (error == nil) { // do something } else { // there was a problem } }
Discussion
Asynchronously check whether subscribable object is already subscribed or not using delegate and callback. This is a non-blocking method.
Declared In
KiiPushSubscription.h
checkSubscriptionSynchronous:withError:
Synchronously check whether subscribable object is already subscribed or not This is a blocking method. (Deprecated: Use instance method instead.)
+ (BOOL)checkSubscriptionSynchronous:(id<KiiSubscribable>)subscribable withError:(NSError *_Nullable *_Nullable)error
Parameters
- subscribable
A subscribable object. Currently, KiiBucket and KiiTopic can be checked for subscription.
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
BOOL YES if the subscribable object is already subscribed, NO if there is no subscription or there is an error during the calls.
Discussion
Synchronously check whether subscribable object is already subscribed or not This is a blocking method.
Declared In
KiiPushSubscription.h
subscribe:withBlock:
Asynchronously subscribe a subscribable object using block. This is a non-blocking method. [KiiPushSubscription subscribe:aBucket withBlock:^(KiiPushSubscription subscription, NSError error) { if (nil == error) { NSLog(@“Subscribed”); } }]; (Deprecated: Use instance method instead.)
+ (void)subscribe:(id<KiiSubscribable>)subscribable withBlock:(KiiPushSubscriptionBlock)completion
Parameters
- completion
block to handle after process completed
Discussion
Asynchronously subscribe a subscribable object using block. This is a non-blocking method. [KiiPushSubscription subscribe:aBucket withBlock:^(KiiPushSubscription subscription, NSError error) { if (nil == error) { NSLog(@“Subscribed”); } }];
Declared In
KiiPushSubscription.h
subscribe:withDelegate:andCallback:
Asynchronously subscribe a subscribable object using delegate and callback. This is a non-blocking method.
+ (void)subscribe:(id<KiiSubscribable>)subscribable withDelegate:(id)delegate andCallback:(SEL)callback
Parameters
- delegate
The object to make any callback requests to
- callback
The callback method to be called when the request is completed. The callback method should have a signature similar to:
- (void)bucketSubscribed:(KiiPushSubscription*)subscription withError:(NSError*)error { // check whether the request was successful if (error == nil) { // do something } else { // there was a problem } }
Discussion
Asynchronously subscribe a subscribable object using delegate and callback. This is a non-blocking method.
Declared In
KiiPushSubscription.h
subscribeSynchronous:withError:
Synchronously subscribe a subscribable object. This is a blocking method. (Deprecated: Use instance method instead.)
+ (nullable KiiPushSubscription *)subscribeSynchronous:(id<KiiSubscribable>)subscribable withError:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Synchronously subscribe a subscribable object. This is a blocking method.
Declared In
KiiPushSubscription.h
unsubscribe:withBlock:
Asynchronously unsubscribe a subscribable object using block This is a non-blocking method. [KiiPushSubscription unsubscribe:aBucket withBlock:^(KiiPushSubscription subscription, NSError error) { if (nil == error) { NSLog(@“Unsubscribed”); } }]; (Deprecated: Use instance method instead.)
+ (void)unsubscribe:(id<KiiSubscribable>)subscribable withBlock:(KiiPushSubscriptionBlock)completion
Parameters
- completion
block to handle after process completed
Discussion
Asynchronously unsubscribe a subscribable object using block This is a non-blocking method. [KiiPushSubscription unsubscribe:aBucket withBlock:^(KiiPushSubscription subscription, NSError error) { if (nil == error) { NSLog(@“Unsubscribed”); } }];
Declared In
KiiPushSubscription.h
unsubscribe:withDelegate:andCallback:
Asynchronously unsubscribe a subscribable object using delegate and callback This is a non-blocking method.
+ (void)unsubscribe:(id<KiiSubscribable>)subscribable withDelegate:(id)delegate andCallback:(SEL)callback
Parameters
- delegate
The object to make any callback requests to
- callback
The callback method to be called when the request is completed. The callback method should have a signature similar to:
- (void)bucketUnsubscribed:(KiiPushSubscription*)subscription withError:(NSError*)error { // check whether the request was successful if (error == nil) { // do something } else { // there was a problem } }
Discussion
Asynchronously unsubscribe a subscribable object using delegate and callback This is a non-blocking method.
Declared In
KiiPushSubscription.h
unsubscribeSynchronous:withError:
Synchronously unsubscribe a subscribable object. This is a blocking method. (Deprecated: Use instance method instead.)
+ (nullable KiiPushSubscription *)unsubscribeSynchronous:(id<KiiSubscribable>)subscribable withError:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Synchronously unsubscribe a subscribable object. This is a blocking method.
Declared In
KiiPushSubscription.h
Instance Methods
checkIsSubscribed:block:
Asynchronously check whether subscribable object is already subscribed or not using block. This is a non-blocking method.
- (void)checkIsSubscribed:(id<KiiSubscribable>)subscribable block:(KiiSubscribableBlock)completion
Parameters
- subscribable
A subscribable object. Currently, KiiBucket and KiiTopic can be checked for subscription.
- completion
block to handle after process completed
Discussion
Asynchronously check whether subscribable object is already subscribed or not using block. This is a non-blocking method.
KiiPushSubscription *aPushSubscription = [[KiiUser currentUser] pushSubscription];
[aPushSubscription checkIsSubscribed:bucket block:^(id<KiiSubscribable> subscribable, BOOL result, NSError *error) {
if (result) {
NSLog(@"subscribed");
}
}];
Declared In
KiiPushSubscription.h
checkIsSubscribedSynchronous:error:
Synchronously check whether subscribable object is already subscribed or not This is a blocking method.
- (BOOL)checkIsSubscribedSynchronous:(id<KiiSubscribable>)subscribable error:(NSError *_Nullable *_Nullable)error
Parameters
- subscribable
A subscribable object. Currently, KiiBucket and KiiTopic can be checked for subscription.
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
BOOL YES if the subscribable object is already subscribed, NO if there is no subscription or there is an error during the calls.
Discussion
Synchronously check whether subscribable object is already subscribed or not This is a blocking method.
Declared In
KiiPushSubscription.h
subscribe:block:
Asynchronously subscribe a subscribable object using block. This is a non-blocking method.
- (void)subscribe:(id<KiiSubscribable>)subscribable block:(KiiPushSubscriptionBlock)completion
Parameters
- completion
block to handle after process completed
Discussion
Asynchronously subscribe a subscribable object using block. This is a non-blocking method.
KiiPushSubscription *aPushSubscription = [[KiiUser currentUser] pushSubscription];
[aPushSubscription subscribe:aBucket block:^(KiiPushSubscription *subscription, NSError *error) {
if (nil == error) {
NSLog(@"Subscribed");
}
}];
Declared In
KiiPushSubscription.h
subscribeSynchronous:error:
Synchronously subscribe a subscribable object. This is a blocking method.
- (BOOL)subscribeSynchronous:(id<KiiSubscribable>)subscribable error:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously subscribe a subscribable object. This is a blocking method.
Declared In
KiiPushSubscription.h
unsubscribe:block:
Asynchronously unsubscribe a subscribable object using block This is a non-blocking method.
- (void)unsubscribe:(id<KiiSubscribable>)subscribable block:(KiiPushSubscriptionBlock)completion
Parameters
- completion
block to handle after process completed
Discussion
Asynchronously unsubscribe a subscribable object using block This is a non-blocking method.
KiiPushSubscription *aPushSubscription = [[KiiUser currentUser] pushSubscription];
[aPushSubscription unsubscribe:aBucket block:^(KiiPushSubscription *subscription, NSError *error) {
if (nil == error) {
NSLog(@"Unsubscribed");
}
}];
Declared In
KiiPushSubscription.h
unsubscribeSynchronous:error:
Synchronously unsubscribe a subscribable object. This is a blocking method.
- (BOOL)unsubscribeSynchronous:(id<KiiSubscribable>)subscribable error:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass NULL if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously unsubscribe a subscribable object. This is a blocking method.
Declared In
KiiPushSubscription.h