Configure Widget Project

Last Updated on : 2023-05-25 06:23:46

Create a widget

Perform the following steps:

  1. Modify the Podfile.
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
            end
        end
    end
    
  2. Set AppGroups:
    1. Grant permissions on AppGroups.
    2. Get the security image, AppKey, and AppSecret from the Thing IoT Development Platform, and configure them to initialize the SDK. Before the SDK is initialized with AppKey, set APP_GROUP_NAME.
      [ThingSmartSDK sharedInstance].appGroupId = APP_GROUP_NAME;
      [[ThingSmartSDK sharedInstance] startWithAppKey:SDK_APPKEY secretKey:SDK_APPSECRET];
      

Use the SDK

  • Set homeId in the main project.
  • Use ThingSmartDeviceModel.switchDp to check whether a device supports quick toggles.
  • Use viewWillAppear to check whether accounts and rooms are changed in the main project. If so, refresh the data.