tencent cloud

SDK Quick Integration
Last updated: 2025-12-05 22:23:36
SDK Quick Integration
Last updated: 2025-12-05 22:23:36
Note:
Example for integration: You can Get the iOS Demo on GitHub.

Prerequisites

Environment requirements

iOS >= 9.0
Xcode >= 10.0

Component dependency

tars
MQQComponents
TMFShark
SSZipArchive
PromiseObjC
MJRefresh
SocketRocket
Brotli
CocoaAsyncSocket

Integration method

TCMPPSDK can be integrated in the following ways:
CocoaPods integration
Manual integration
SPM integration

CocoaPods integration

1. Add the source and mini program dependency modules to the Podfile in your project:
# Pods repository
source 'https://e.coding.net/tcmpp-work/tcmpp/tcmpp-repo.git'

target 'YourTarget' do
# ――― TCSAS -----―――――――――――――――――――――――――――――――――――――――――――――――――――――--- #
pod 'TCMPPSDK'
pod 'TCMPPExtScanCode'
pod 'TCMPPExtMedia'
# Preset base library
pod 'TCSASBaseLib'
end
In this case, Replace YourTarget with the name of the target in your project that requires the SDK.
2. Run cd on the Terminal to go to the Podfile directory and run pod install to install the component.
$ pod install
Note:
If you encounter the error Couldn't determine repo type for URL: 'https://github.com/TCMPP-Team/tcmpp-repo.git': you need to run the following command before executing pod install: pod repo add specs https://github.com/TCMPP-Team/tcmpp-repo.git.

Manual integration

Note:
Example for integration: You can click here to download the manual integration demo.
1. Add the SDK
Add the directory of the SDK components to the appropriate location in your Xcode project and select the relevant target.
You can quickly add the components by dragging the directory directly from Finder into your Xcode project.

2. Add dependent SDKs
Add all components depended on by SDK to the project. For the list of dependent components, see Component dependency.
3. Add dependent system libraries
Add the system libraries that the SDK depends on to the project, open the project settings page in Xcode, select the target, and click General to add them under Linked Frameworks and Libraries.
4. The system library dependencies are as follows:
Foundation.framework
CoreTelephony.framework
CFNetwork.framework
Security.framework
SystemConfiguration.framework
CoreService.framework
CoreFoundation.framework
libz.tbd
libc++.tbd
libc.tbd
libbz2.tbd
libsqlite3.0.tbd
5. Project settings
After adding the SDK, you need to make the following project settings in Xcode:
Select Build Settings > Linking > Other Linker Flags, and add -ObjC.
Select Build Settings > Apple Clang - Custom Compiler Flags > Other C Flags, and add
-fshort-wchar
-D__FIXWCHART__
Select Build Phases > Copy Bundle Resources, and add the SDK resource file:




SPM integration

Select File > Add Packages in Xcode, and enter the URL in the search window:https://github.com/TCMPP-Team/TCMPPSDK.git

Select the version rule (Up to Next Major Version is recommended) and click Add Package.
After adding the SDK, make the following project settings in Xcode:
Select Build Settings > Linking > Other Linker Flags, and add -ObjC.
For adding other extension libraries, refer to:https://github.com/TCMPP-Team/TCMPPSDK

Obtain the configuration file

The initialization of the mini program SDK relies on the configuration file obtained from the SAS (Super App as a Service) console. Before integrating the mini program SDK, you need to get this configuration file.
Log in to the console, and click Create superapp.

Fill in the superapp information.

Add Bundle ID.


Download the configuration file.
Note:
The default name of the downloaded configuration file is tcsas-ios-configurations.json.


Add the configuration file to the project

After obtaining the configuration file, add it to your superapp’s source code.
Note:
The bundleId of the iOS project must match the bundleId configured in the console. If they do not match, the mini program SDK will lead to initialization errors.


Add permission settings

If you have only integrated the core library of the SDK, namely TCMPPSDK, you need to add permission request information in the info.plist file.
The permissions involved with the core SDK (TCMPPSDK) are as follows:
Permission
Corresponding KEY
Involved API
Photo library write
NSPhotoLibraryAddUsageDescription
saveImageToPhotosAlbum, saveVideoToPhotosAlbum
Camera
NSCameraUsageDescription
CameraContext (Camera component)
Microphone
NSMicrophoneUsageDescription
CameraContext (Camera component)
If you need to use the extension SDK, you must also add the corresponding permission request information in the project's info.plist file.
For details, refer to SDK Extension Components .

Configure to support landscape mode

The loading page in the SDK, video components, etc., support landscape mode, but the superapp project must also support it.
Please check the following options in Xcode settings:

Note:
If landscape mode is not enabled, the landscape features in the SDK will not work.

Import the header file

Import the header file into AppDelegate.
//TCSAS
#import <TCMPPSDK/TCMPPSDK.h>

Set the configuration information

Initialize the TMAServerConfig object based on the configuration file, and use it to initialize the mini program engine.
The SDK supports direct engine initialization, preparing network connections in advance, and updating base library and configuration information to speed up mini program loading. It can also support initialization when needed.
Example:
// Configure the environment
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"tcsas-ios-configurations" ofType:@"json"];
if(filePath) {
TMAServerConfig *config = [[TMAServerConfig alloc] initWithFile:filePath];
// Direct initialization
[[TMFMiniAppSDKManager sharedInstance] setConfiguration:config];
}

Other initialization operations

You can set up the implementation instance of the open API as needed. If integrating extension modules, prepare the initialization of the extension API.
// Set the mini program engine delegate
[TMFMiniAppSDKManager sharedInstance].miniAppSdkDelegate = [MIniAppDemoSDKDelegateImpl sharedInstance];
MIniAppDemoSDKDelegateImpl must implement the TMFMiniAppSDKDelegate protocol. See Introduction and the MIniAppDemoSDKDelegateImpl file in the Demo project.

Open a mini program

You can directly call the API to open the mini program using the appid:
[[TMFMiniAppSDKManager sharedInstance] startUpMiniAppWithAppID:appId parentVC:self completion:^(NSError * _Nullable error) {
NSLog(@"open applet error:%@",error);
}];



Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback