KiiThing Class Reference
Inherits from | KiiBaseObject : NSObject |
Declared in | KiiThing.h |
Overview
Represent Thing on KiiCloud. There are two types of property of KiiThing, reserve and custom.
Reserve Fields
Reserve keys can not be used as the key of [KiiBaseObject setObject:forKey:] methods of KiiThing.
To set/get the value of these reserve fields, you use the property accessor of these field.
- _thingID
- _vendorThingID
- _password
- _thingType
- _vendor
- _firmwareVersion
- _productName
- _lot
- _created
- _stringField1
- _stringField2
- _stringField3
- _stringField4
- _stringField5
- _numberField1
- _numberField2
- _numberField3
- _numberField4
- _numberField5
- _accessToken
Custom Fields
Custom field includes any field choose by you, other than reserve field.
Custom field can have NString, NSNumber type values and collections (NSArray/NSDictionary) contains NSString/NSNumber.
Setter/getter ([KiiBaseObject setObject:forKey:] , [KiiBaseObject getObjectForKey:] ) method of these type can be used to set/get the custom field.
Note: KiiThing does not support removal of fields from Server.
Tasks
-
thingID
property -
vendorThingID
property -
thingType
property -
vendor
property -
firmwareVersion
property -
productName
property -
lot
property -
created
property -
stringField1
property -
stringField2
property -
stringField3
property -
stringField4
property -
stringField5
property -
numberField1
property -
numberField2
property -
numberField3
property -
numberField4
property -
numberField5
property -
accessToken
property -
disabled
property -
online
property -
onlineStatusModifiedAt
property -
+ thingWithID:
-
– enable:
-
– enableSynchronous:
-
– disable:
-
– disableSynchronous:
-
+ loadWithVendorThingID:block:
-
+ loadSynchronousWithVendorThingID:error:
-
+ loadWithThingID:block:
-
+ loadSynchronousWithThingID:error:
-
– unregisterOwner:block:
-
– unregisterOwnerSynchronous:error:
-
– registerOwner:block:
-
– registerOwnerSynchronous:error:
-
+ registerOwnerSynchronous:thingID:error:
-
+ registerOwner:thingID:block:
-
+ registerOwnerSynchronous:vendorThingID:error:
-
+ registerOwner:vendorThingID:block:
-
– registerOwner:thingPassword:block:
-
– registerOwnerSynchronous:thingPassword:error:
-
+ registerOwnerSynchronous:thingID:thingPassword:error:
-
+ registerOwner:thingID:thingPassword:block:
-
+ registerOwnerSynchronous:vendorThingID:thingPassword:error:
-
+ registerOwner:vendorThingID:thingPassword:block:
-
+ registerThing:password:type:fields:block:
-
+ registerThingSynchronous:password:type:fields:error:
-
– checkIsOwnerSynchronous:error:
-
– checkIsOwner:block:
-
– refresh:
-
– refreshSynchronous:
-
– update:
-
– updateSynchronous:
-
– delete:
-
– deleteWithBlock:
-
– deleteSynchronous:
-
– bucketWithName:
-
– encryptedBucketWithName:
-
– topicWithName:
-
– pushSubscription
-
– listTopicsSynchronous:
-
– listTopicsSynchronous:error:
-
– listTopics:
-
– listTopics:block:
-
+ querySynchronous:error:
-
+ query:block:
Properties
accessToken
Get the accessToken.
@property (nonatomic, readonly, nullable) NSString *accessToken
Discussion
Get the accessToken.
Declared In
KiiThing.h
created
Get created date.
@property (nonatomic, readonly, nullable) NSDate *created
Discussion
Get created date.
Declared In
KiiThing.h
disabled
Get disabled status of the thing.YES if the thing is disabled, NO otherwise.
@property (nonatomic, readonly) BOOL disabled
Discussion
Get disabled status of the thing.YES if the thing is disabled, NO otherwise.
Declared In
KiiThing.h
firmwareVersion
Set and get firmwareVersion.
@property (nonatomic, nullable) NSString *firmwareVersion
Discussion
Set and get firmwareVersion.
Declared In
KiiThing.h
lot
Set and get the lot.
@property (nonatomic, nullable) NSString *lot
Discussion
Set and get the lot.
Declared In
KiiThing.h
numberField1
Set and get the numberField1.
@property (nonatomic, nullable) NSNumber *numberField1
Discussion
Set and get the numberField1.
Declared In
KiiThing.h
numberField2
Set and get the numberField2.
@property (nonatomic, nullable) NSNumber *numberField2
Discussion
Set and get the numberField2.
Declared In
KiiThing.h
numberField3
Set and get the numberField3.
@property (nonatomic, nullable) NSNumber *numberField3
Discussion
Set and get the numberField3.
Declared In
KiiThing.h
numberField4
Set and get the numberField4.
@property (nonatomic, nullable) NSNumber *numberField4
Discussion
Set and get the numberField4.
Declared In
KiiThing.h
numberField5
Set and get the numberField5.
@property (nonatomic, nullable) NSNumber *numberField5
Discussion
Set and get the numberField5.
Declared In
KiiThing.h
online
Get online status of the thing. NSNumber boolean represenetation. The value will be nil initially until the thing is connected for the first time. If not nil and converted to BOOL, YES if the thing is online, NO otherwise.
@property (nonatomic, readonly, nullable) NSNumber *online
Discussion
Get online status of the thing. NSNumber boolean represenetation. The value will be nil initially until the thing is connected for the first time. If not nil and converted to BOOL, YES if the thing is online, NO otherwise.
Declared In
KiiThing.h
onlineStatusModifiedAt
Get online status modified date of the thing. The date will be nil initially until the thing is connected for the first time.
@property (nonatomic, readonly, nullable) NSDate *onlineStatusModifiedAt
Discussion
Get online status modified date of the thing. The date will be nil initially until the thing is connected for the first time.
Declared In
KiiThing.h
productName
Set and get productName.
@property (nonatomic, nullable) NSString *productName
Discussion
Set and get productName.
Declared In
KiiThing.h
stringField1
Set and get the stringField1.
@property (nonatomic, nullable) NSString *stringField1
Discussion
Set and get the stringField1.
Declared In
KiiThing.h
stringField2
Set and get the stringField2.
@property (nonatomic, nullable) NSString *stringField2
Discussion
Set and get the stringField2.
Declared In
KiiThing.h
stringField3
Set and get the stringField3.
@property (nonatomic, nullable) NSString *stringField3
Discussion
Set and get the stringField3.
Declared In
KiiThing.h
stringField4
Set and get the stringField4.
@property (nonatomic, nullable) NSString *stringField4
Discussion
Set and get the stringField4.
Declared In
KiiThing.h
stringField5
Set and get the stringField5.
@property (nonatomic, nullable) NSString *stringField5
Discussion
Set and get the stringField5.
Declared In
KiiThing.h
thingID
Get the thingID.
@property (nonatomic, readonly) NSString *thingID
Discussion
Get the thingID.
Declared In
KiiThing.h
thingType
Set and get thingType.
@property (nonatomic, nullable) NSString *thingType
Discussion
Set and get thingType.
Declared In
KiiThing.h
Class Methods
loadSynchronousWithThingID:error:
Synchronously load registered thing in Kii Cloud by using thingID.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
+ (nullable instancetype)loadSynchronousWithThingID:(NSString *)thingID error:(NSError *_Nullable *_Nullable)error
Parameters
- thingID
identifier given by Kii Cloud.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
an instance of registered thing.
Discussion
Synchronously load registered thing in Kii Cloud by using thingID.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
Exceptions
- NSInvalidArgumentException
Thrown if thingID is nil or empty string.
Declared In
KiiThing.h
loadSynchronousWithVendorThingID:error:
Synchronously load registered thing in Kii Cloud by using vendorThingID.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
+ (nullable instancetype)loadSynchronousWithVendorThingID:(NSString *)vendorThingID error:(NSError *_Nullable *_Nullable)error
Parameters
- vendorThingID
identifier given by thing vendor.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
an instance of registered thing.
Discussion
Synchronously load registered thing in Kii Cloud by using vendorThingID.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
Exceptions
- NSInvalidArgumentException
Thrown if vendorThingID is nil or empty string.
Declared In
KiiThing.h
loadWithThingID:block:
Asynchronously load registered thing in Kii Cloud by using thingID. This method is non-blocking version of [KiiThing loadSynchronousWithThingID:error:]
+ (void)loadWithThingID:(NSString *)thingID block:(KiiThingBlock)block
Parameters
- thingID
identifier given by Kii Cloud.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously load registered thing in Kii Cloud by using thingID. This method is non-blocking version of [KiiThing loadSynchronousWithThingID:error:]
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
Successful operation will return an instance in a block parameter.
[KiiThing loadWithThingID:thingID
block:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing loaded: %@", thing);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if thingID is nil or empty string.
Declared In
KiiThing.h
loadWithVendorThingID:block:
Asynchronously load registered thing in Kii Cloud by using vendorThingID. This method is non-blocking version of [KiiThing loadSynchronousWithVendorThingID:error:]
+ (void)loadWithVendorThingID:(NSString *)vendorThingID block:(KiiThingBlock)block
Parameters
- vendorThingID
identifier given by thing vendor.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously load registered thing in Kii Cloud by using vendorThingID. This method is non-blocking version of [KiiThing loadSynchronousWithVendorThingID:error:]
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
Successful operation will return an instance in a block parameter.
[KiiThing loadWithVendorThingID:vendorThingID
block:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing loaded: %@", thing);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if vendorThingID is nil or empty string.
Declared In
KiiThing.h
query:block:
Asyncronously execute thing query. The query operation returns a list of KiiThing that matches the query expression. Thing in the list does not contain all the property of thing. To get all the property from cloud, a refresh: is necessary. This method is a non-blocking version of [KiiThing querySynchronous:error:]
+ (void)query:(KiiThingQuery *)query block:(KiiThingQueryResultBlock _Nonnull)block
Parameters
- block
The block to be called upon method completion. See example.
Discussion
Asyncronously execute thing query. The query operation returns a list of KiiThing that matches the query expression. Thing in the list does not contain all the property of thing. To get all the property from cloud, a refresh: is necessary. This method is a non-blocking version of [KiiThing querySynchronous:error:]
[aThing query:aThingQuery block:^(KiiThingQueryResult *queryResult, NSError *error){
if(error == nil) {
NSLog(@"Got Results: %@", results);
NSLog(@"Total result %@", queryResult.results.count);
NSLog(@"Has Next: %@ next", queryResult.hasNext?@"Yes":@"No");
}
}];
Declared In
KiiThing.h
querySynchronous:error:
Syncronously execute thing query. The query operation returns a list of KiiThing that matches the query expression. Thing in the list does not contain all the property of thing. To get all the property from cloud, a refresh: is necessary. This is non blocking operation.
+ (KiiThingQueryResult *_Nullable)querySynchronous:(KiiThingQuery *)query error:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
Thing query result.
Discussion
Syncronously execute thing query. The query operation returns a list of KiiThing that matches the query expression. Thing in the list does not contain all the property of thing. To get all the property from cloud, a refresh: is necessary. This is non blocking operation.
Declared In
KiiThing.h
registerOwner:thingID:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:thingID:error:]. (Deprecated: This method is deprecated. Use [KiiThing registerOwner:thingID:thingPassword:block:])
+ (void)registerOwner:(id<KiiThingOwner>)owner thingID:(NSString *)thingID block:(KiiThingOwnerBlock)block
Parameters
- owner
to be registered as owner
- thingID
ID of the KiiThing to instantiate.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronous version of [KiiThing registerOwnerSynchronous:thingID:error:].
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Successful operation will return an instance in a block parameter.
[KiiThing registerOwner:owner
thingID:@"YourThingID"
block:^(KiiThingOwner *owner, NSError *error) {
if(error == nil) {
NSLog(@"Thing owner registered: %@", owner);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwner:thingID:thingPassword:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:thingID:thingPassword:error:].
+ (void)registerOwner:(id<KiiThingOwner>)owner thingID:(NSString *)thingID thingPassword:(NSString *)thingPassword block:(KiiThingOwnerBlock)block
Parameters
- owner
to be registered as owner
- thingID
ID of the KiiThing to instantiate.
- thingPassword
Password of the target thing.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronous version of [KiiThing registerOwnerSynchronous:thingID:thingPassword:error:].
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Successful operation will return an instance in a block parameter.
[KiiThing registerOwner:owner thingID:@“YourThingID” thingPassword: thingPassword block:^(KiiThingOwner owner, NSError error) { if(error == nil) { NSLog(@“Thing owner registered: %@”, owner); } }];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwner:vendorThingID:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:vendorThingID:error:]. (Deprecated: This method is deprecated. Use [KiiThing registerOwner:vendorThingID:thingPassword:error:])
+ (void)registerOwner:(id<KiiThingOwner>)owner vendorThingID:(NSString *)vendorThingID block:(KiiThingOwnerBlock)block
Parameters
- owner
to be registered as owner
- vendorThingID
identifier given by thing vendor.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronous version of [KiiThing registerOwnerSynchronous:vendorThingID:error:].
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Successful operation will return an instance in a block parameter.
[KiiThing registerOwner:owner
vendorThingID:@"YourVendorhingID"
block:^(KiiThingOwner *owner, NSError *error) {
if(error == nil) {
NSLog(@"Thing owner registered: %@", owner);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwner:vendorThingID:thingPassword:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:vendorThingID:thingPassword:error:].
+ (void)registerOwner:(id<KiiThingOwner>)owner vendorThingID:(NSString *)vendorThingID thingPassword:(NSString *)thingPassword block:(KiiThingOwnerBlock)block
Parameters
- owner
to be registered as owner
- vendorThingID
identifier given by thing vendor.
- thingPassword
Password of the target thing.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronous version of [KiiThing registerOwnerSynchronous:vendorThingID:thingPassword:error:].
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Successful operation will return an instance in a block parameter.
[KiiThing registerOwner:owner vendorThingID:@“YourVendorhingID” thingPassword: thingPassword block:^(KiiThingOwner owner, NSError error) { if(error == nil) { NSLog(@“Thing owner registered: %@”, owner); } }];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:thingID:error:
Register owner of specified thing. This is a blocking method. (Deprecated: This method is deprecated. Use [KiiThing registerOwnerSynchronous:thingID:thingPassword:error:])
+ (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner thingID:(NSString *)thingID error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
to be registered as owner
- thingID
ID of the KiiThing to instantiate.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Register owner of specified thing. This is a blocking method.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
This api is authorized by owner of the Thing.
Need user login before execute this API.
NOTE: This api access to server. Should not be executed in UI/Main thread.
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:thingID:thingPassword:error:
Register owner of specified thing. This is a blocking method.
+ (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner thingID:(NSString *)thingID thingPassword:(NSString *)thingPassword error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
to be registered as owner
- thingID
ID of the KiiThing to instantiate.
- thingPassword
Password of the target thing.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Register owner of specified thing. This is a blocking method.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
This api is authorized by owner of the Thing.
Need user login before execute this API.
NOTE: This api access to server. Should not be executed in UI/Main thread.
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:vendorThingID:error:
Register owner of specified thing. This is a blocking method. (Deprecated: This method is deprecated. Use [KiiThing registerOwnerSynchronous:vendorThingID:thingPassword:error:])
+ (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner vendorThingID:(NSString *)vendorThingID error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
to be registered as owner
- vendorThingID
identifier given by thing vendor.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Register owner of specified thing. This is a blocking method.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
This api is authorized by owner of the Thing.
Need user login before execute this API.
NOTE: This api access to server. Should not be executed in UI/Main thread.
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:vendorThingID:thingPassword:error:
Register owner of specified thing. This is a blocking method.
+ (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner vendorThingID:(NSString *)vendorThingID thingPassword:(NSString *)thingPassword error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
to be registered as owner
- vendorThingID
identifier given by thing vendor.
- thingPassword
Password of the target thing.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Discussion
Register owner of specified thing. This is a blocking method.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
This api is authorized by owner of the Thing.
Need user login before execute this API.
NOTE: This api access to server. Should not be executed in UI/Main thread.
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
- An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerThing:password:type:fields:block:
Asynchronously register thing in Kii Cloud using block. This method is non-blocking version of [KiiThing registerThingSynchronous:password:type:fields:error:]
+ (void)registerThing:(NSString *)vendorThingID password:(NSString *)password type:(nullable NSString *)thingType fields:(nullable KiiThingFields *)thingFields block:(KiiThingBlock)block
Parameters
- vendorThingID
identifier. This is required.
- password
for Thing. This is required.
- thingType
the thing device type. This is optional.
- thingFields
a
object.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously register thing in Kii Cloud using block. This method is non-blocking version of [KiiThing registerThingSynchronous:password:type:fields:error:]
[KiiThing registerThing: vendorThingID
password: password
type: thingType
fields: thingFields
block:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing registered: %@", thing);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if vendorThingID is nil or empty string.
- NSInvalidArgumentException
Thrown if password is nil or empty string.
Declared In
KiiThing.h
registerThingSynchronous:password:type:fields:error:
Synchronously register thing in Kii Cloud.
This is blocking method.
It doesn’t require user login. Anonymous user can register thing.
+ (nullable instancetype)registerThingSynchronous:(NSString *)vendorThingID password:(NSString *)password type:(nullable NSString *)thingType fields:(nullable KiiThingFields *)thingFields error:(NSError *_Nullable *_Nullable)error
Parameters
- vendorThingID
identifier. This is required.
- password
for Thing. This is required.
- thingType
the thing device type. This is optional.
- thingFields
a
object.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
an instance of registered
Discussion
Synchronously register thing in Kii Cloud.
This is blocking method.
It doesn’t require user login. Anonymous user can register thing.
Exceptions
- NSInvalidArgumentException
Thrown if vendorThingID is nil or empty string.
- NSInvalidArgumentException
Thrown if password is nil or empty string.
Declared In
KiiThing.h
thingWithID:
Create a KiiThing that refers to existing thing which has specified ID. You have to specify the ID of existing KiiThing. Unlike KiiObject, you can not assign ID in the client side. After instantiation, call [KiiThing refresh:] to fetch the properties.
+ (instancetype)thingWithID:(NSString *)thingID
Parameters
- thingID
Thing ID. You must not set vendor thing ID instead of thing ID.
Return Value
instance of KiiThing or nil.
Discussion
Create a KiiThing that refers to existing thing which has specified ID. You have to specify the ID of existing KiiThing. Unlike KiiObject, you can not assign ID in the client side. After instantiation, call [KiiThing refresh:] to fetch the properties.
Declared In
KiiThing.h
Instance Methods
bucketWithName:
Get or create a bucket at the thing level
- (KiiBucket *)bucketWithName:(NSString *)bucketName
Parameters
- bucketName
The name of the bucket you’d like to use. It has to match the pattern ^[A-Za-z0-9-]{1,64}$, that is letters, numbers, ‘-’ and ‘’ and non-multibyte characters with a length between 1 and 64 characters.
Return Value
An instance of a working KiiBucket
Discussion
Get or create a bucket at the thing level
Exceptions
- NSInvalidArgumentException
Thrown if bucketName is invalid. Please refers to parameter description for valid pattern.
Declared In
KiiThing.h
checkIsOwner:block:
Asynchronously check if user/group is owner of the thing. This method is non-blocking version of checkIsOwnerSynchronous:error:
- (void)checkIsOwner:(id<KiiThingOwner>)thingOwner block:(KiiThingIsOwnerBlock)block
Parameters
- thingOwner
user or group to be checked.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously check if user/group is owner of the thing. This method is non-blocking version of checkIsOwnerSynchronous:error:
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
Checks ownership of the thing from specified user/ group.
[aThing checkIsOwner:thingOwner block:^(KiiThing *thing, id<KiiThingOwner> thingOwner, BOOL isOwner, NSError *error) {
if(error == nil) {
NSLog(@"%@ is %@ the owner" , thingOwner.thingOwnerID,isOwner?@"":@"not");
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
checkIsOwnerSynchronous:error:
Synchronously check if user/ group is owner of the thing.
This is blocking method.
This API is authorized by owner of thing.
Need user login before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)checkIsOwnerSynchronous:(id<KiiThingOwner>)thingOwner error:(NSError *_Nullable *_Nullable)error
Parameters
- thingOwner
user or group to be checked.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
YES if passed parameter is the owner of thing, NO otherwise.
Discussion
Synchronously check if user/ group is owner of the thing.
This is blocking method.
This API is authorized by owner of thing.
Need user login before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
delete:
Asynchronously deletes the Thing from the server. (Deprecated: use [KiiThing deleteWithBlock:] instead.)
- (void)delete:(nullable KiiThingBlock)block
Discussion
Asynchronously deletes the Thing from the server.
Declared In
KiiThing.h
deleteSynchronous:
Synchronously deletes the Thing from the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)deleteSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil 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 deletes the Thing from the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
It will delete bucket, topic which belongs to this thing, entity belongs to the bucket/topic and all ownership information of thing. This operation can not be reverted. Please carefully use this.
Declared In
KiiThing.h
deleteWithBlock:
Asynchronously deletes the Thing from the server. This method is non-blocking version of deleteSynchronous:
- (void)deleteWithBlock:(nullable KiiThingBlock)block
Parameters
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously deletes the Thing from the server. This method is non-blocking version of deleteSynchronous:
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
It will delete bucket, topic which belongs to this thing, entity belongs to the bucket/topic and all ownership information of thing. This operation can not be reverted. Please carefully use this. This is a non-blocking method.
[aThing deleteWithBlock:^(KiiThing *thing, NSError *error) {
if(error != nil) {
// Handle error
return;
}
// thing has been deleted.
}];
Declared In
KiiThing.h
disable:
Asynchronously disable the thing in Kii Cloud. This method is a non-blocking version of disableSynchronous:
- (void)disable:(nonnull KiiThingBlock)block
Parameters
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously disable the thing in Kii Cloud. This method is a non-blocking version of disableSynchronous:
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
After succeeded, access token published for thing is disabled. In a result, only the app administrator and owners of thing can access the thing. Used when user lost the thing and avoid using by unknown users. It doesn’t throw error when the thing is already disabled.
[aThing disable:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing is disabled: %@", thing);
}
}];
Declared In
KiiThing.h
disableSynchronous:
Synchronously disable the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)disableSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil 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 disable the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
After succeeded, access token published for thing is disabled. In a result, only the app administrator and owners of thing can access the thing. Used when user lost the thing and avoid using by unknown users. It doesn’t throw error when the thing is already disabled.
Declared In
KiiThing.h
enable:
Asynchronously enable the thing in Kii Cloud. This method is non-blocking version of enableSynchronous:
- (void)enable:(KiiThingBlock)block
Parameters
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously enable the thing in Kii Cloud. This method is non-blocking version of enableSynchronous:
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
After succeeded, If thing is registered with “persistentToken” option, token should be recovered (Access token which is used before disabling can be available). Otherwise, it does not recovered.
It doesn’t throw error when the thing is already enabled.
[aThing enable:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing is enabled: %@", thing);
}
}];
Declared In
KiiThing.h
enableSynchronous:
Synchronously enable the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)enableSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil 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 enable the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
After succeeded, If thing is registered with “persistentToken” option, token should be recovered (Access token which is used before disabling can be available). Otherwise, it does not recovered.
It doesn’t throw error when the thing is already enabled.
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
Declared In
KiiThing.h
encryptedBucketWithName:
Get or create an thing scope encrypted bucket.
- (KiiEncryptedBucket *)encryptedBucketWithName:(NSString *)bucketName
Parameters
- bucketName
The name of the encrypted bucket you’d like to use.
Return Value
An instance of a working KiiEncryptedBucket
Discussion
Get or create an thing scope encrypted bucket.
Exceptions
- NSInvalidArgumentException
when bucketName is not acceptable format. For details please refer to <[KiiBucket isValidBucketName:(NSString*) bucketName]>.
Declared In
KiiThing.h
listTopics:
Returns the topics in this thing scope asynchronously.
- (void)listTopics:(KiiListResultBlock)completion
Parameters
- completion
The block to be called upon method completion, this is mandatory. See example.
Discussion
Returns the topics in this thing scope asynchronously.
Receives a KiiListResult object representing list of topics. This is a non-blocking request.
[aThing listTopics:^(KiiListResult *topics, id callerObject, NSError *error){
//at this scope, callerObject should be KiiThing instance
NSLog(@"%@",callerObject);
if(error == nil) {
NSLog(@"Got Results: %@", topics);
NSLog(@"Total topics: %@", topics.results.count);
NSLog(@"Has Next: %@ next paginationKey: %@", topics.hasNext?@"Yes":@"No", topics.paginationKey);
KiiTopic *firstTopic = topics.result.firstObject;
if (firstTopic){
NSLog(@"topic name :%@", firstTopic.name);
}
}
}];
Exceptions
- NSInvalidArgumentException
if completion is nil.
Declared In
KiiThing.h
listTopics:block:
Returns the topics in this thing scope asynchronously.
- (void)listTopics:(nullable NSString *)paginationKey block:(KiiListResultBlock)completion
Parameters
- paginationKey
pagination key. If nil or empty value is specified, this API regards no paginationKey specified.
- completion
The block to be called upon method completion, this is mandatory. See example.
Discussion
Returns the topics in this thing scope asynchronously.
Receives a KiiListResult object representing list of topics. This is a non-blocking request.
[aThing listTopics:paginationKey block:^(KiiListResult *topics, id callerObject, NSError *error){
//at this scope, callerObject should be KiiThing instance
NSLog(@"%@",callerObject);
if(error == nil) {
NSLog(@"Got Results: %@", topics);
NSLog(@"Total topics: %@", topics.results.count);
NSLog(@"Has Next: %@ next paginationKey: %@", topics.hasNext?@"Yes":@"No", topics.paginationKey);
KiiTopic *firstTopic = topics.result.firstObject;
if (firstTopic){
NSLog(@"topic name :%@", firstTopic.name);
}
}
}];
Exceptions
- NSInvalidArgumentException
if completion is nil.
Declared In
KiiThing.h
listTopicsSynchronous:
Returns the topics in this Thing scope. This is blocking method.
- (nullable KiiListResult *)listTopicsSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
a KiiListResult object representing list of topics in this thing scope.
Discussion
Returns the topics in this Thing scope. This is blocking method.
Declared In
KiiThing.h
listTopicsSynchronous:error:
Returns the topics in this thing scope. This is blocking method.
- (nullable KiiListResult *)listTopicsSynchronous:(nullable NSString *)paginationKey error:(NSError *_Nullable *_Nullable)error
Parameters
- paginationKey
pagination key. If nil or empty value is specified, this API regards no paginationKey specified.
- error
used to return an error by reference (pass nil if this is not desired). It is recommended to set an actual error object to get the error information.
Return Value
a KiiListResult object representing list of topics in this thing scope.
Discussion
Returns the topics in this thing scope. This is blocking method.
Declared In
KiiThing.h
pushSubscription
Get or create a push subscription for the thing.
- (KiiPushSubscription *)pushSubscription
Return Value
An instance of a working KiiPushSubscription
Discussion
Get or create a push subscription for the thing.
Declared In
KiiThing.h
refresh:
Asynchronously updates the local Thing’s data with the Thing data on the server. This method is non-blocking version of refreshSynchronous:
- (void)refresh:(KiiThingBlock)block
Parameters
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously updates the local Thing’s data with the Thing data on the server. This method is non-blocking version of refreshSynchronous:
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
The Thing must exist on the server. Local data will be overwritten.
[aThing refresh:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing refreshed: %@", thing);
}
}];
Declared In
KiiThing.h
refreshSynchronous:
Synchronously updates the local Thing’s data with the Thing data on the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)refreshSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil 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 updates the local Thing’s data with the Thing data on the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
The Thing must exist on the server. Local data will be overwritten. This is a blocking method.
Declared In
KiiThing.h
registerOwner:block:
Asynchronously register owner of the thing in Kii Cloud. This method is non-blocking version of registerOwnerSynchronous:error: (Deprecated: This method is deprecated. Use [KiiThing registerOwner:thingPassword:block:])
- (void)registerOwner:(id<KiiThingOwner>)owner block:(KiiThingBlock)block
Parameters
- owner
user or group that own the Thing.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously register owner of the thing in Kii Cloud. This method is non-blocking version of registerOwnerSynchronous:error:
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
[aThing registerOwner: owner
block:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing owner registered: %@", thing);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwner:thingPassword:block:
Asynchronously register owner of the thing in Kii Cloud. This method is non-blocking version of registerOwnerSynchronous:thingPassword:error:
- (void)registerOwner:(id<KiiThingOwner>)owner thingPassword:(NSString *)thingPassword block:(KiiThingBlock)block
Parameters
- owner
user or group that own the Thing.
- thingPassword
Password of the target thing.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously register owner of the thing in Kii Cloud. This method is non-blocking version of registerOwnerSynchronous:thingPassword:error:
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
[aThing registerOwner: owner thingPassword: thingPassword block:^(KiiThing thing, NSError error) { if(error == nil) { NSLog(@“Thing owner registered: %@”, thing); } }];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:error:
Synchronously register owner of the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login before execute this API. (Deprecated: This method is deprecated. Use [KiiThing registerOwnerSynchronous:thingPassword:error:])
- (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
user or group that own the Thing.
- error
used to return an error by reference (pass nil 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 register owner of the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login before execute this API.
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
registerOwnerSynchronous:thingPassword:error:
Synchronously register owner of the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login before execute this API.
- (BOOL)registerOwnerSynchronous:(id<KiiThingOwner>)owner thingPassword:(NSString *)thingPassword error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
user or group that own the Thing.
- thingPassword
Password of the target thing.
- error
used to return an error by reference (pass nil 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 register owner of the thing in Kii Cloud.
This is a blocking method.
This API is authorized by owner of thing.
Need user login before execute this API.
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipExist]) will be returned if the passed thing owner (user/group) is already the owner.
After the registration, owner can access the thing, buckets, objects in bucket, and topics belongs to the thing.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
topicWithName:
Get or create a Push notification topic at the thing level
- (KiiTopic *)topicWithName:(NSString *)topicName
Parameters
- topicName
The name of the topic you’d like to use. It has to match the pattern ^[A-Za-z0-9-]{1,64}$, that is letters, numbers, ‘-’ and ‘’ and non-multibyte characters with a length between 1 and 64 characters.
Return Value
An instance of a working KiiTopic
Discussion
Get or create a Push notification topic at the thing level
Exceptions
- NSInvalidArgumentException
Thrown if topicName is invalid. Please refers to parameter description for valid pattern.
Declared In
KiiThing.h
unregisterOwner:block:
Asynchronously unregister owner of the thing in Kii Cloud. This method is non-blocking version of unregisterOwnerSynchronous:error:
- (void)unregisterOwner:(id<KiiThingOwner>)owner block:(KiiThingBlock)block
Parameters
- owner
user or group that own the Thing.
- block
The block to be called upon method completion. See example.
Discussion
Asynchronously unregister owner of the thing in Kii Cloud. This method is non-blocking version of unregisterOwnerSynchronous:error:
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipNotFound]) will be returned if the passed thing owner (user/group) is not the owner.
Remove ownership of the thing from specified user/ group.
[aThing unregisterOwner: owner
block:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing owner unregistered: %@", thing);
}
}];
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
unregisterOwnerSynchronous:error:
Synchronously unregister owner of the thing in Kii Cloud. This is a blocking method.
- (BOOL)unregisterOwnerSynchronous:(id<KiiThingOwner>)owner error:(NSError *_Nullable *_Nullable)error
Parameters
- owner
user or group that own the Thing.
- error
used to return an error by reference (pass nil 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 unregister owner of the thing in Kii Cloud. This is a blocking method.
Remove ownership of the thing from specified user/ group.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
An error (error code: [KiiError codeThingOwnerNotFound]) will be returned if the passed thing owner (user/group) is not found or already deleted.
An error (error code: [KiiError codeThingOwnershipNotFound]) will be returned if the passed thing owner (user/group) is not the owner.
Exceptions
- NSInvalidArgumentException
Thrown if owner is nil or not an instance of KiiUser or KiiGroup.
Declared In
KiiThing.h
update:
Asynchronously saves the latest Thing values to the server This method is non-blocking version of updateSynchronous:
- (void)update:(KiiThingBlock)block
Parameters
- block
The block to be called upon method completion. See example
Discussion
Asynchronously saves the latest Thing values to the server This method is non-blocking version of updateSynchronous:
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
The Thing must exist in order to make this method call. If the Thing does exist, the application-specific fields that have changed will be updated accordingly. This is a non-blocking method.
[aThing update:^(KiiThing *thing, NSError *error) {
if(error == nil) {
NSLog(@"Thing saved: %@", thing);
}
}];
Declared In
KiiThing.h
updateSynchronous:
Synchronously saves the latest Thing values to the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call registerOwnerSynchronous:error:
- (BOOL)updateSynchronous:(NSError *_Nullable *_Nullable)error
Parameters
- error
used to return an error by reference (pass nil 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 saves the latest Thing values to the server.
This is a blocking method.
This API is authorized by owner of thing.
Need user login who owns this thing before execute this API.
To let users to own Thing, please call <registerOwnerSynchronous:error:>
- An error (error code: [KiiError codeThingNotFound]) will be returned if the thing is not found or already deleted.
The Thing must exist in order to make this method call. If the Thing does exist, the application-specific fields that have changed will be updated accordingly. This is a blocking method.
Declared In
KiiThing.h