Smart App SDKSmart Community App SDKDeveloper Guide for iOSFast Integration with Smart Community App SDK for iOS

Fast Integration with Smart Community App SDK for iOS

Last Updated on : 2021-11-12 07:00:19download

This topic describes how to use CocoaPods to quickly integrate Tuya Smart Community App SDK for iOS into your project. The SDK requires iOS 10.0 or later.

Add the SDK to the project

For more information about CocoaPods, see CocoaPods Guides. We recommend that you update CocoaPods to the latest version.

  1. Add the following code block to the Podfile:

    platform :ios, '10.0'
    target 'Your_Project_Name' do
         pod 'TuyaCommunityKit'
  2. In the root directory of your project, run pod update.

Initialize the SDK

Project settings

  1. Open the project settings, click Target > General, and then modify Bundle Identifier to the iOS Bundle ID set on the Tuya IoT Platform

  2. Import the security image to the root directory of the project, and rename it as t_s.bmp. Go to Project Settings > Target > Build Phases, and add this image to Copy Bundle Resources.

    Fast Integration with Smart Community App SDK for iOS

    Fast Integration with Smart Community App SDK for iOS

  3. Add the following code line to the PrefixHeader.pch file.

        #import <TuyaCommunityKit/TuyaCommunityKit.h>
  4. Open the AppDelegate.m file and initialize the SDK by using the TuyaSmartSDK class in the method [AppDelegate application:didFinishLaunchingWithOptions:].

API description

Use TuyaSmartSDK to initialize the SDK.

- (void)startWithAppKey:(NSString *)appKey secretKey:(NSString *)secretKey;


Parameter Description
appKey AppKey
secretKey AppSecret


[[TuyaSmartSDK sharedInstance] startWithAppKey:<#your_app_key#> secretKey:<#your_secret_key#>];

Now, you are ready for app development.

Enable the debug mode

During the development, you can enable the debug mode and print logs for troubleshooting.

#ifdef DEBUG
    [[TuyaSmartSDK sharedInstance] setDebugMode:YES];

Run the sample

In the following example, a demo app is used to describe the process of app development with the App SDK. Before the development of your app, we recommend that you run the demo app.

In the Preparation topic, get the AppKey, AppSecret, and security image for iOS. Make sure that the BundleId, AppKey, AppSecret, and security image, are consistent with those used on the Tuya IoT Platform. Any mismatch will cause the SDK development or demo app to be failed.

Feature overview

The demo app supports the following features:

  • Login: Register and login with a mobile phone number or email address.
  • Home and device management: Create homes and switch between homes. Display a list of devices in a home and control data points (DPs) of the devices. Rename and remove devices.
  • Smart scenes: Create and run smart scenes.
  • User information: Display and manage user information.


Troubleshoot the error message: Permission Verification Failed

  "success" : false,
  "errorCode" : "SING_VALIDATE_FALED",
  "status" : "error",
  "errorMsg" : "Permission Verification Failed",
  "t" : 1583208740059