Door Lock SDK Integration
1. Overview
This article mainly introduces how iOS integrates the door lock SDK.
2. Preconditions
- Confirm completion of Preparation and Environment Build
- This article defaults that you have installed Xcode 14 or above, and CocoaPods 1.9.0 or above;
3. Features
3.1 Main function
- Support Aqara door lock network access.
- Support Aqara door lock control.
3.2 SDK Size
| Dependent library | Description | Size |
|---|---|---|
| AHRNRuntime | RN runtime static library (React Native runtime built in) | - |
| LMRnFramework | Door lock RN bridge layer and plugin resources | - |
| LMFramework | Aqara basic library | - |
Note: The above are reference increments after integrating the SDK. The actual increment depends on how much overlap exists with the host app's existing dependencies.
3.3 Support equipment category
See Equipment List
4. Integration
4.1 iOS SDK Directory Structure
LMRnFramework/
├── LMRnFramework.framework # Door lock RN bridge layer
├── AHRNRuntime.framework # RN runtime static library
├── hermes.xcframework # Hermes engine
├── Resources/
│ └── PKGResource/ # Door lock RN plugin resources
└── LMRnFramework.podspec
Contents include:
- Aqara bridge layer:
LMRnFramework.framework - RN runtime:
AHRNRuntime.framework,hermes.xcframework(provided as static libraries — no need to integrate React Native source code) - RN plugin package:
Resources/PKGResourcedirectory
4.2 How to use
The door lock SDK is provided via LMRnFramework, with the RN runtime packaged in AHRNRuntime.framework. Local CocoaPods integration is recommended.
Important change: The legacy approach of manually integrating React Native source pods such as
ReactandReact-Coreis deprecated. Do not add those dependencies.
1. Permission Profile
The SDK needs to apply to iOS for the following system permissions:
NSLocalNetworkUsageDescription— local network lookup permissionNSLocationWhenInUseUsageDescription— location permission (required to obtain WiFi name on iOS 13+; iOS 14 requires precise location. If WiFi name still cannot be obtained, handle manually such as prompting user input)NSBluetoothAlwaysUsageDescription— Bluetooth permission
You can quickly add the following configuration in the host project's Info.plist:
<key>NSBonjourServices</key>
<array>
<string>_aqara._tcp.</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Need to use local network to discover device information on LAN</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Allow this app to use bluetooth connection</string>
2. Copy SDK
Copy the LMRnFramework folder into your project's AqaraFrameworks directory (same structure as the Demo project).
3. Configure Podfile
The door lock SDK depends on basic libraries. Ensure LMFramework, LMCommonUISwift, LMSwiftCore, and other base SDKs are integrated per Environment Build.
Add the door lock SDK dependency in your Podfile:
pod 'LMRnFramework', :path => './AqaraFrameworks/LMRnFramework'
LMRnFramework automatically brings in the following via its podspec — no manual addition needed:
| Dependency | Description |
|---|---|
| AHRNRuntime.framework | RN runtime static library |
| hermes.xcframework | Hermes JS engine |
| SocketRocket | WebSocket communication |
| TOCropViewController | Image cropping |
| LMFramework | Aqara basic library |
| LMCommonUISwift | Swift UI component library |
| LMSwiftCore | Swift core library |
Run pod install to complete the door lock SDK integration.
5. SDK Usage
For how to use the SDK, please refer to the next document: Door lock SDK usage (iOS).