KiiTopic Class Reference
Inherits from | NSObject |
Conforms to | KiiSubscribable |
Declared in | KiiTopic.h |
Properties
name
Name of the topic
@property (nonatomic, readonly) NSString *name
Discussion
Name of the topic
Declared In
KiiTopic.h
topicACL
Get the ACL handle for this topic. Any KiiACLEntry objects added or revoked from this ACL object will be appended to/removed from the server on ACL save.
@property (readonly) KiiACL *topicACL
Discussion
Get the ACL handle for this topic. Any KiiACLEntry objects added or revoked from this ACL object will be appended to/removed from the server on ACL save.
Declared In
KiiTopic.h
Instance Methods
checkIfExists:
Asynchronously checks whether the topic already exists or not.
- (void)checkIfExists:(KiiTopicExistenceBlock)completion
Parameters
- completion
The block to be called upon method completion, this is mandatory. See example.
Discussion
Asynchronously checks whether the topic already exists or not.
This is a non-blocking method. If the topic does not exist, no error will be returned.
[obj checkIfExists:^(KiiTopic *topic, BOOL isExists, NSError *error) {
if(error == nil) {
if(isExists) {
NSLog(@"Topic exists");
}
}else {
// handle error here
}
}];
Exceptions
- NSInvalidArgumentException
if completion is nil.
Declared In
KiiTopic.h
checkIfExistsSynchronous:
Checks whether the topic already exists or not. This is blocking method.
- (BOOL)checkIfExistsSynchronous:(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 the topic is exist, NO otherwise.
Discussion
Checks whether the topic already exists or not. This is blocking method.
Declared In
KiiTopic.h
delete:withCallback:
Asynchronously deletes the latest topic values to the server
- (void)delete:(id)delegate withCallback:(SEL)callback
Parameters
- delegate
The topic 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) topicDeleted:(KiiTopic*)topic withError:(NSError*)error { // check whether the request was successful if(error == nil) { // do something with the topic } else { // there was a problem } }
Discussion
Asynchronously deletes the latest topic values to the server
If the topic does not exist, an error (code 705) will be returned. This is a non-blocking method.
Declared In
KiiTopic.h
deleteSynchronous:
Synchronously deletes the latest topic values to the server
- (BOOL)deleteSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
An NSError topic, set to nil, to test for errors
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously deletes the latest topic values to the server
If the topic does not exist, the there will be an error. This is a blocking method.
Declared In
KiiTopic.h
deleteWithBlock:
Asynchronously deletes the topic to the server
- (void)deleteWithBlock:(KiiTopicBlock)block
Parameters
- block
The block to be called upon method completion. See example
Discussion
Asynchronously deletes the topic to the server
If the topic does not exist, an error (code 705) will be returned. This is a non-blocking method.
[obj deleteWithBlock:^(KiiTopic *topic, NSError *error) {
if(error == nil) {
NSLog(@"topic saved: %@", topic);
}
}];
Declared In
KiiTopic.h
save:withCallback:
Asynchronously saves the latest topic values to the server
- (void)save:(id)delegate withCallback:(SEL)callback
Parameters
- delegate
The topic 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) topicSaved:(KiiTopic*)topic withError:(NSError*)error { // check whether the request was successful if (error == nil) { // do something with the topic } else { // there was a problem } }
Discussion
Asynchronously saves the latest topic values to the server
If the topic does not yet exist, it will be created. If the topic already exists, an error (code 704) will be returned. This is a non-blocking method.
Declared In
KiiTopic.h
saveSynchronous:
Synchronously saves the latest topic values to the server
- (BOOL)saveSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
An NSError topic, set to nil, to test for errors
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously saves the latest topic values to the server
If the topic does not yet exist, it will be created. If the topic already exists, an error (code 704) will be returned. This is a blocking method.
Declared In
KiiTopic.h
saveWithBlock:
Asynchronously saves the topic to the server
- (void)saveWithBlock:(KiiTopicBlock)block
Parameters
- block
The block to be called upon method completion. See example
Discussion
Asynchronously saves the topic to the server
If the topic does not yet exist, it will be created. If the topic already exists, an error (code 704) will be returned. This is a non-blocking method.
[obj saveWithBlock:^(KiiTopic *topic, NSError *error) {
if (error == nil) {
NSLog(@"topic saved: %@", topic);
}
}];
Declared In
KiiTopic.h
sendMessage:withBlock:
Asynchronously send Kii explicit push notification to topic.
- (void)sendMessage:(KiiPushMessage *)message withBlock:(KiiTopicBlock)block
Parameters
- message
The message data of KiiPushMessage to send push notification.
- block
The block to be called upon method completion. See example
Discussion
Asynchronously send Kii explicit push notification to topic.
This is a non-blocking method. If the topic does not exist, an error (code 705) will be returned. If message has gcmFields defined, the data and specific data will be validated for GCM reserved keys, an error (code 712) will be returned if it contains any GCM reserved keys.
[obj sendMessage:message withBlock:^(KiiTopic *topic, NSError *error) {
if(error == nil) {
NSLog(@"message sent: %@", topic);
}
}];
Declared In
KiiTopic.h
sendMessage:withDelegate:andCallback:
Asynchronously send Kii explicit push notification to topic
- (void)sendMessage:(KiiPushMessage *)message withDelegate:(id)delegate andCallback:(SEL)callback
Parameters
- message
The message data of KiiPushMessage to send push notification.
- delegate
The topic 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) messageSent:(KiiTopic*)topic withError:(NSError*)error { // check whether the request was successful if(error == nil) { // do something with the topic } else { // there was a problem } }
Discussion
Asynchronously send Kii explicit push notification to topic
This is a non-blocking method. If the topic does not exist, an error (code 705) will be returned. If message has gcmFields defined, the data and specific data will be validated for GCM reserved keys, an error (code 712) will be returned if it contains any GCM reserved keys.
Declared In
KiiTopic.h
sendMessageSynchronous:withError:
Synchronously send Kii explicit push notification to topic.
- (BOOL)sendMessageSynchronous:(KiiPushMessage *)message withError:(NSError *_Nullable *_Nullable)error
Parameters
- message
The message data of KiiPushMessage to send push notification.
- error
An NSError topic, set to nil, to test for errors
Return Value
YES if succeeded, NO otherwise.
Discussion
Synchronously send Kii explicit push notification to topic.
This is a blocking method. If the topic does not exist, an error (code 705) will be returned. If message has gcmFields defined, the data and specific data will be validated for GCM reserved keys, an error (code 712) will be returned if it contains any GCM reserved keys.
Declared In
KiiTopic.h