Tuya Smart APP SDK provides the interface package for the communication with hardware and Tuya Cloud to accelerate the application development process, including the following features:
- Hardware functions (network configuration, control, status reporting, regular tasks, groups, firmware upgrades, sharing)
- Account system (phone number, email registration, login, password reset and other general account functions)
- Home system (home management, room management)
Add the following content in file
pod update in the project's root directory to begin integration.
For the instructions of CocoaPods, please refer to: CocoaPods Guides
Open project setting,
Target => General, edit
Bundle Identifierto the value from Tuya develop center.
Import security image to the project and rename as
t_s.bmp, then add it into
Project Setting => Target => Build Phases => Copy Bundle Resources.
Add the following to the project file
Swift project add the following to the
- Open file
AppDelegate.m，and use the
App Secretobtained from the development platform in the
[AppDelegate application:didFinishLaunchingWithOptions:]method to initialize SDK:
[[TuyaSmartSDK sharedInstance] startWithAppKey:<#your_app_key#> secretKey:<#your_secret_key#>];
TuyaSmartSDK.sharedInstance()?.start(withAppKey: <#your_app_key#>, secretKey: <#your_secret_key#>)
Now all the prepare work has been completed. You can use the sdk to develop your application now.
During the development we can open debug mode, print the log to analyze some problem.
#ifdef DEBUG [[TuyaSmartSDK sharedInstance] setDebugMode:YES]; #else #endif
#if DEBUG TuyaSmartSDK.sharedInstance()?.debugMode = true #else #endif