Sample Code for lettest version of SDK
# | Date | Name | Download |
---|---|---|---|
1 | 07/11/2023 | Symmetric Key Sample IOS v1.0.1 | Download |
How to build iOS sample code?
Prerequisite tools:
- Xcode: Minimum iOS 10.0 Compatible
Installation:
- Get the “IoTConnect.framework” and add in the framework in iOS App Project
Public Methods and Implementations
Import iOS library
#import <IoTConnect/IoTConnectSDK.h>
Objective-C
Define SDK object
IoTConnectSDK *objectIoTSDK;
SDK Init Call
NSString *uniqueId=@"sdk001"; NSString *cpId=@"abcde1"; NSString *strEnv=@"<ENV>”; objectIoTSDK =[[IoTConnectSDK alloc] init: cpId : uniqueId : strEnv :^(id message) { /* Handle Cloud to Device message */ }];
Send sensor data call
NSArray *data=@[@{ @"uniqueId":@"sdk001", @"time":@"2018-03-06T11:38:53.000Z", @"data":@{@"temperature":@"45",@"humidity":@"40" } }];
Send Temperature and Humidity
[objIoTConnect SendData:data];
Swift
SDK Init Call
var uniqueId="sdk001" var cpId="abcde1" var strEnv="<<ENV>>” objectIoTConnect = IoTConnectSDK(cpId, uniqueId, strEnv, { (message) in /* Handle Cloud to Device message */ })
Send Temperature and Humidity
objectIoTConnect.sendData(data)