Last Updated on : 2024-05-28 03:08:51download
This topic describes how to quickly integrate the Smart Industry App SDK for iOS into your development environment, such as Xcode. It also sheds light on the initialization method and how to enable the debugging mode with a few simple steps. This allows you to run the demo app and get started with your smart industry app development.
Each app is provided with a unique and secure SDK. This topic describes how to integrate the SDK v2.2.0 into your project using CocoaPods.
On the SDK Development page, click the target SDK to show the Get SDK tab.
After extracting the downloaded ios_core_sdk.tar.gz
, you will get three important files:
Build
: The secure SDK specific to your app. It is as important as the app key, so be sure to keep it safe.ThingSmartCryption.podspec
: Used to import and integrate the SDK v2.2.0.domain.txt
: The domain for making requests, including six data centers.It is recommended to store the Build
and ThingSmartCryption.podspec
folders in the same directory as the podfile
to facilitate reference and operation later.
Declare the following in the podfile
:
# Build and get the ThingSmartCryption from platform.tuya.com.
# After purchasing the official edition, rebuild the SDK on the Developer Platform and integrate it into your project again.
# ./ indicates that you extract 'ios_core_sdk.tar.gz' to the same directory as the podfile.
# To save the extracted file to a different location, adjust the path as needed.
pod 'ThingSmartCryption', :path => './'
The podfile
downloaded from the Tuya Developer Platform already declares the feature SDK you selected. You can get the reference declarations for other feature SDKs from the podfile
.
Executing $ pod update
will automatically integrate the downloaded SDK into your iOS project.
Open the project settings on Xcode, choose Target > General, and then modify Bundle Identifier to the iOS Bundle ID set on the Tuya Developer Platform.
On the SDK Development page, click the target SDK and then the Get Key tab.
The projectCode
information is required for user login. On the Cloud Development page, click Open Project in the Operation column to show the project Overview.
Client ID and Client Secret are required to initialize the SDK.
On the Cloud Development page, click Open Project in the Operation column.
Choose Authorization > App Authorization.
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()
When integrating with the SDK, make sure the BundleId
, AppKey
, AppSecret
, clientID
, and clientSecret
are consistent with those used on the Tuya Developer Platform. Any mismatch will cause the SDK development to fail.
The request host must match the data center of the cloud project, because data from different data centers is isolated.
AY
: China Data CenterEU
: Central Europe Data CenterAZ
: Western America Data CenterWE
: Western Europe Data CenterUE
: Eastern America Data CenterIN
: India Data CenterThe SDK development edition is for development purposes only and should not be used commercially. To publish your app on app stores, purchase the official edition.
After you purchase the official edition:
For more information, see Tuya Developing Service Agreement.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback