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
-
thingIDproperty -
vendorThingIDproperty -
thingTypeproperty -
vendorproperty -
firmwareVersionproperty -
productNameproperty -
lotproperty -
createdproperty -
stringField1property -
stringField2property -
stringField3property -
stringField4property -
stringField5property -
numberField1property -
numberField2property -
numberField3property -
numberField4property -
numberField5property -
accessTokenproperty -
disabledproperty -
onlineproperty -
onlineStatusModifiedAtproperty -
+ 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 *accessTokenDiscussion
Get the accessToken.
Declared In
KiiThing.hcreated
Get created date.
@property (nonatomic, readonly, nullable) NSDate *createdDiscussion
Get created date.
Declared In
KiiThing.hdisabled
Get disabled status of the thing.YES if the thing is disabled, NO otherwise.
@property (nonatomic, readonly) BOOL disabledDiscussion
Get disabled status of the thing.YES if the thing is disabled, NO otherwise.
Declared In
KiiThing.hfirmwareVersion
Set and get firmwareVersion.
@property (nonatomic, nullable) NSString *firmwareVersionDiscussion
Set and get firmwareVersion.
Declared In
KiiThing.hlot
Set and get the lot.
@property (nonatomic, nullable) NSString *lotDiscussion
Set and get the lot.
Declared In
KiiThing.hnumberField1
Set and get the numberField1.
@property (nonatomic, nullable) NSNumber *numberField1Discussion
Set and get the numberField1.
Declared In
KiiThing.hnumberField2
Set and get the numberField2.
@property (nonatomic, nullable) NSNumber *numberField2Discussion
Set and get the numberField2.
Declared In
KiiThing.hnumberField3
Set and get the numberField3.
@property (nonatomic, nullable) NSNumber *numberField3Discussion
Set and get the numberField3.
Declared In
KiiThing.hnumberField4
Set and get the numberField4.
@property (nonatomic, nullable) NSNumber *numberField4Discussion
Set and get the numberField4.
Declared In
KiiThing.hnumberField5
Set and get the numberField5.
@property (nonatomic, nullable) NSNumber *numberField5Discussion
Set and get the numberField5.
Declared In
KiiThing.honline
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 *onlineDiscussion
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.honlineStatusModifiedAt
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 *onlineStatusModifiedAtDiscussion
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.hproductName
Set and get productName.
@property (nonatomic, nullable) NSString *productNameDiscussion
Set and get productName.
Declared In
KiiThing.hstringField1
Set and get the stringField1.
@property (nonatomic, nullable) NSString *stringField1Discussion
Set and get the stringField1.
Declared In
KiiThing.hstringField2
Set and get the stringField2.
@property (nonatomic, nullable) NSString *stringField2Discussion
Set and get the stringField2.
Declared In
KiiThing.hstringField3
Set and get the stringField3.
@property (nonatomic, nullable) NSString *stringField3Discussion
Set and get the stringField3.
Declared In
KiiThing.hstringField4
Set and get the stringField4.
@property (nonatomic, nullable) NSString *stringField4Discussion
Set and get the stringField4.
Declared In
KiiThing.hstringField5
Set and get the stringField5.
@property (nonatomic, nullable) NSString *stringField5Discussion
Set and get the stringField5.
Declared In
KiiThing.hthingID
Get the thingID.
@property (nonatomic, readonly) NSString *thingIDDiscussion
Get the thingID.
Declared In
KiiThing.hthingType
Set and get thingType.
@property (nonatomic, nullable) NSString *thingTypeDiscussion
Set and get thingType.
Declared In
KiiThing.hClass 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)errorParameters
- 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.hloadSynchronousWithVendorThingID: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)errorParameters
- 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.hloadWithThingID: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)blockParameters
- 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.hloadWithVendorThingID: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)blockParameters
- 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.hquery: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)blockParameters
- 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.hquerySynchronous: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)errorParameters
- 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.hregisterOwner: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)blockParameters
- 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.hregisterOwner:thingID:thingPassword:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:thingID:thingPassword:error:].
+ (void)registerOwner:(id<KiiThingOwner>)owner thingID:(NSString *)thingID thingPassword:(NSString *)thingPassword block:(KiiThingOwnerBlock)blockParameters
- 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.hregisterOwner: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)blockParameters
- 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.hregisterOwner:vendorThingID:thingPassword:block:
Asynchronous version of [KiiThing registerOwnerSynchronous:vendorThingID:thingPassword:error:].
+ (void)registerOwner:(id<KiiThingOwner>)owner vendorThingID:(NSString *)vendorThingID thingPassword:(NSString *)thingPassword block:(KiiThingOwnerBlock)blockParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.hregisterThing: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)blockParameters
- 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.hregisterThingSynchronous: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)errorParameters
- 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.hthingWithID:
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 *)thingIDParameters
- 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.hInstance Methods
bucketWithName:
Get or create a bucket at the thing level
- (KiiBucket *)bucketWithName:(NSString *)bucketNameParameters
- 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.hcheckIsOwner: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)blockParameters
- 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.hcheckIsOwnerSynchronous: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)errorParameters
- 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.hdelete:
Asynchronously deletes the Thing from the server. (Deprecated: use [KiiThing deleteWithBlock:] instead.)
- (void)delete:(nullable KiiThingBlock)blockDiscussion
Asynchronously deletes the Thing from the server.
Declared In
KiiThing.hdeleteSynchronous:
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)errorParameters
- 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.hdeleteWithBlock:
Asynchronously deletes the Thing from the server. This method is non-blocking version of deleteSynchronous:
- (void)deleteWithBlock:(nullable KiiThingBlock)blockParameters
- 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.hdisable:
Asynchronously disable the thing in Kii Cloud. This method is a non-blocking version of disableSynchronous:
- (void)disable:(nonnull KiiThingBlock)blockParameters
- 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.hdisableSynchronous:
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)errorParameters
- 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.henable:
Asynchronously enable the thing in Kii Cloud. This method is non-blocking version of enableSynchronous:
- (void)enable:(KiiThingBlock)blockParameters
- 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.henableSynchronous:
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)errorParameters
- 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.hencryptedBucketWithName:
Get or create an thing scope encrypted bucket.
- (KiiEncryptedBucket *)encryptedBucketWithName:(NSString *)bucketNameParameters
- 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.hlistTopics:
Returns the topics in this thing scope asynchronously.
- (void)listTopics:(KiiListResultBlock)completionParameters
- 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.hlistTopics:block:
Returns the topics in this thing scope asynchronously.
- (void)listTopics:(nullable NSString *)paginationKey block:(KiiListResultBlock)completionParameters
- 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.hlistTopicsSynchronous:
Returns the topics in this Thing scope. This is blocking method.
- (nullable KiiListResult *)listTopicsSynchronous:(NSError *_Nullable *_Nullable)errorParameters
- 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.hlistTopicsSynchronous:error:
Returns the topics in this thing scope. This is blocking method.
- (nullable KiiListResult *)listTopicsSynchronous:(nullable NSString *)paginationKey error:(NSError *_Nullable *_Nullable)errorParameters
- 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.hpushSubscription
Get or create a push subscription for the thing.
- (KiiPushSubscription *)pushSubscriptionReturn Value
An instance of a working KiiPushSubscription
Discussion
Get or create a push subscription for the thing.
Declared In
KiiThing.hrefresh:
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)blockParameters
- 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.hrefreshSynchronous:
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)errorParameters
- 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.hregisterOwner: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)blockParameters
- 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.hregisterOwner: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)blockParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.hregisterOwnerSynchronous: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)errorParameters
- 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.htopicWithName:
Get or create a Push notification topic at the thing level
- (KiiTopic *)topicWithName:(NSString *)topicNameParameters
- 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.hunregisterOwner: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)blockParameters
- 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.hunregisterOwnerSynchronous:error:
Synchronously unregister owner of the thing in Kii Cloud. This is a blocking method.
- (BOOL)unregisterOwnerSynchronous:(id<KiiThingOwner>)owner error:(NSError *_Nullable *_Nullable)errorParameters
- 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.hupdate:
Asynchronously saves the latest Thing values to the server This method is non-blocking version of updateSynchronous:
- (void)update:(KiiThingBlock)blockParameters
- 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.hupdateSynchronous:
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)errorParameters
- 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