This sample provides Tuya Industry App SDK examples of basic functions such as device network configuration, login and registration, and asset management of Tuya Open API.
Industry App SDK Sample has the following functions:
- User module (login, logout)
- Asset module (asset query, selection)
- Equipment distribution module (AP, QRcode mode)
- Equipment module (equipment query, equipment unbinding)
iOS Industry App SDK API Reference: https://tuya.github.io/tuya-ios-iot-app-sdk-sample/
-
A developer account is registered on the Tuya IoT Development Platform.
-
Your account identity is verified.
This section describes the steps to configure an industry project on top of Cloud Development. For more information, see Quick Start.
-
Log in to the Tuya IoT Development Platform.
-
In the left-side navigation bar, choose Cloud > Development.
-
On the page that appears, click Create Cloud Project.
-
In the Create Cloud Project dialog box:
- Set Project Name, Description, Industry, and Data Center.
Info: Tuya deploys six data centers globally and provides reliable IoT cloud services for customers worldwide. You can select one or more data centers where your services are deployed. This setting can be changed later.
-
Click Create to continue with project configuration.
-
On the Authorize API Services page, besides the default selections, you need to subscribe to the API products such as Device Status Notification and Industry Project Client Service, and click Authorize.
Info: By default, the API services IoT Core and Authorization are selected.
-
Click Authorize.
-
Enter the asset and account information. Then, the asset will be automatically created and the account will be granted access to the asset. For more information, see Asset Management.
Info: Tuya provides IoT Core that drives your success with industry-specific device connection and management capabilities. This service can quickly integrate with existing systems and boost your development of IoT core applications targeted to different industry scenarios.
Execute $ pod update
and the downloaded SDK will be automatically integrated into the iOS project.
- Open the project settings, click Target > General, and then modify Bundle Identifier to the iOS Bundle ID set on the Tuya IoT Platform
The user needs the projectCode information when logging in.
When initializing the SDK, you need the Client ID and Client Secret information.
Objective-C
// init url
[IndustryLinkSDK setHost:<#your_app_host#>];
// IndustryLinkSDK
[IndustryLinkSDK initializeWithAppKey:<#your_app_key#>
appSecret:<#your_app_secret_key#>
clientId:<#your_clientId#>
clientSecret:<#your_client_secret#>];
[MQTTBusinessPlugin initializePlugin];
Swift
// init url
IndustryLinkSDK.host = <#your_app_host#>
// IndustryLinkSDK
IndustryLinkSDK.initialize(withAppKey: <#your_app_key#>,
appSecret: <#your_app_secret_key#>,
clientId: <#your_clientId#>,
clientSecret: <#your_client_secret#>)
// If need mqtt
MQTTBusinessPlugin.initializePlugin()
Note In the Preparation topic, get the
AppKey
,AppSecret
,BundleId
,ClientId
andClientSecret
for iOS. Make sure that the values are consistent with those used on the Tuya IoT Platform. Any mismatch will cause the SDK development or demo app to be failed. Please initialize the host using the domain names from the domain.txt file downloaded from the platform.
The requested host must be consistent with the data center of the cloud project, as the data in different data centers is isolated from one another.
AY: China Data Center
EU: Central Europe Data Center
AZ: Western America Data Center
WE: Western Europe Data Center
UE: Eastern America Data Center
IN: India Data Center
Development version SDK is for testing purposes only, not for commercial use. To use in commercial scenarios, please purchase the formal version SDK on the platform.
After purchasing the formal version SDK:
- You need to rebuild and download the formal version SDK on the IoT platform.
- Reintegrate the formal version SDK into your project.
You can provide feedback on your issue via GitHub Issue or Ticket.
Tuya Industry App SDK Sample is available under the MIT license. Please see the LICENSE file for more info.