iOS SDK Integrated Guide

Last updated:2023-8-17
Expand all
iOS SDK Integrated Guide

If you use it for the first time JMLink, suggest integration SDK Before you know it. Access Guide

I.SDK Annotations

Applicable version

Text Matches SDK Version:v1.2.0 Later. ViewLatest UpdatesGet up to date. SDK Update.

Resource File

Package Name jmlink-ios-{version number}-release

  • Libs Folder: Contain headers JMLinkService.hStatic library file jmlink-ios-x.x.x.a,jbasic-ios-x.x.x.xcframework
  • Jiguang Demo Folder: Example

DEMO Use

Enter Jiguang Demo Directory, Implementation pod install Command Install sdkOpen Jiguang Demo.xcworkspace Run just fine.

Jiguang Demo为多个SDK拼接组装而成的Demo,使用cocoapods进行管理,如需手动集成请参考[手动导入]部分。
          Jiguang Demo为多个SDK拼接组装而成的Demo,使用cocoapods进行管理,如需手动集成请参考[手动导入]部分。

        
This code block is shown in the floating window

Creating applications

  • Yes. JMLink Management Portal Up-create application, automatically generated after successful creation AppKey To mark the application.

  • Applying Settings iOS module configuration if universal link Not really. Please refer to:Console UL Settings Module

  • Detailed diagrams can be found in the introductory guideCreate Application

III. configuring

3.1. Import SDK

Option 1: Cocoapods Import

pod 'JCore', '4.2.8-jbasic' //必选项,使用 JCore 的 jbasic 版本(x.x.x-jbasic) pod 'JMLink' // 必选项 注:如果无法导入最新版本,请执行 pod repo update master 这个命令来升级本机的 pod 库,然后重新 pod 'JMLink'
          pod 'JCore', '4.2.8-jbasic'    //必选项,使用 JCore 的 jbasic 版本(x.x.x-jbasic)
pod 'JMLink' // 必选项

注:如果无法导入最新版本,请执行 pod repo update master 这个命令来升级本机的 pod 库,然后重新 pod 'JMLink'

        
This code block is shown in the floating window

If integrated at the same time transfer/certification/analysis, use JCore Standard version or none IDFA Version.

  • Standard version: pod 'JCore', '4.2.8'
  • None IDFA Version: pod 'JCore', '4.2.8-noidfa'

Select 2: Manual Import

  • Yes.Jiguang Network of officialsDownload Update SDK
  • After decompression, Lib Folder import project (check for import)Copy items if needed" )

3.2 Basic Configuration

3.2.1 Configure Scheme

Yes.XcodeSelection Rule Target -> Info -> URL TypesI'll fill you in.Jiguang Consolesettings Scheme,xcode Lee. and Console. scheme It must be consistent, as shown in the figure:
jmlink-ios

Yes. Xcode Selection Target -> Capablities -> Associated Domainsfill inJMLinkDistribution of domain names inControl Domain Name Settings ModuleView, put support universal link the domain name is filled in the project. As shown:
jmlink-ios

Not familiar. universal link The configuration process can be viewed Access Guide-iOS Basic Configuration

Note:

  • There's got to be support. universal link All the domain names are filled in for the project. applinks:
  • It is recommended that all domain names in domain name management be configured to the project so as to avoid non-support at the front and back. universal link Domain name not configured, resulting in jump failure

IV.SDK Initialize

Yes.AppDelegate, add header references:

# import "JMLinkService.h"
          # import "JMLinkService.h"

        
This code block is shown in the floating window

Yes.application: didFinishLaunchingWithOptionsCall in MethodsetupWithConfigMethod to Initialize SDKas follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //如需使用 IDFA 功能请添加此代码并在初始化配置类中设置 advertisingId NSString *idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; JMLinkConfig *config = [[JMLinkConfig alloc] init]; config.appKey = @"your appkey"; config.advertisingId = idfaStr; [JMLinkService setupWithConfig:config]; }
          - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //如需使用 IDFA 功能请添加此代码并在初始化配置类中设置 advertisingId
 NSString *idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

 JMLinkConfig *config = [[JMLinkConfig alloc] init];
 config.appKey = @"your appkey";
 config.advertisingId = idfaStr;
 [JMLinkService setupWithConfig:config];
}

        
This code block is shown in the floating window

Functional integration

5.1 One chain to pull.

Yes. app Draw from platforms, browsers where installed app and transmit dynamic parameters.

//iOS9以下,通过url scheme来唤起app - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { [JMLinkService routeMLink:url]; return YES; } //iOS9+,通过url scheme来唤起app - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(nonnull NSDictionary *)options{ [JMLinkService routeMLink:url]; return YES; } //通过universal link来唤起app - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{ [JMLinkService continueUserActivity:userActivity]; return YES; }
          //iOS9以下,通过url scheme来唤起app
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
 [JMLinkService routeMLink:url];
 return YES;
}
//iOS9+,通过url scheme来唤起app
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(nonnull NSDictionary *)options{
 [JMLinkService routeMLink:url];
 return YES;
}
//通过universal link来唤起app
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
 [JMLinkService continueUserActivity:userActivity];
 return YES;
}

        
This code block is shown in the floating window
Note: When neededopenURLWhen dealing with third-party recalls (e.g., payment of treasures, micro-referrals, etc.) in this approach, note the distinction, for example:
// 处理 JMLink 一键唤起APP时传递的数据 [JMLinkService routeMLink:url]; //其他第三方回调 return YES;
          // 处理 JMLink 一键唤起APP时传递的数据
[JMLinkService routeMLink:url];
//其他第三方回调
return YES;

        
This code block is shown in the floating window

5.1.2 Retrieving one-chain stretching parameters

The recommendation is to start APP, add a way to retrieve parameters

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ // SDK初始化 ··· // 注册通用的的获取参数回调方法 [JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) { dispatch_async(dispatch_get_main_queue(), ^{ // 拿到参数后,根据自身项目参数协议解析,处理跳转逻辑 }); }]; }
          - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
 // SDK初始化
 ···

 // 注册通用的的获取参数回调方法
 [JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) {
 dispatch_async(dispatch_get_main_queue(), ^{
 // 拿到参数后,根据自身项目参数协议解析,处理跳转逻辑
 });
 }];
}

        
This code block is shown in the floating window

5.2 Deferred Deep LinkingFunctions

Yes. app In the absence of installation, click short chains from platforms, browsers Load APP, click to open during active time app.

5.2.1 AccessDeferred Deep LinkingParameters

The recommendation is to start APP, add a way to retrieve parameters

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ // SDK初始化 ··· // 注册通用的的获取参数回调方法 [JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) { dispatch_async(dispatch_get_main_queue(), ^{ // 拿到参数后,根据自身项目参数协议解析,自行处理跳转逻辑 }); }]; }
          - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
 // SDK初始化
 ···

 // 注册通用的的获取参数回调方法
 [JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) {
 dispatch_async(dispatch_get_main_queue(), ^{
 // 拿到参数后,根据自身项目参数协议解析,自行处理跳转逻辑
 });
 }];
}

        
This code block is shown in the floating window

5.3 Codeless InviteFunctions

In the scene, the invitation code is waived, the impact of the cumbersome user operation is circumvented and the conversion rate is increased. For example:APP Parameters/playrooms need to be installed to invite good friends/grow activities/establish a top-down relationship, and incentives to open up the application for completion of business need to be installed quickly.

5.3.1 AccessCodeless InviteParameters

// 获取无码邀请中传回来的相关值 [JMLinkService getMLinkParam:nil handler:^(NSDictionary * _Nullable params) { dispatch_async(dispatch_get_main_queue(), ^{ // 拿到参数后,根据自身项目参数协议解析 }); }];
          // 获取无码邀请中传回来的相关值
[JMLinkService getMLinkParam:nil handler:^(NSDictionary * _Nullable params) {
    dispatch_async(dispatch_get_main_queue(), ^{
            // 拿到参数后,根据自身项目参数协议解析
    });
}];

        
This code block is shown in the floating window

Note:

  • This interface can be called anywhere
  • Repeatable calls return several times and follow-up does not want to be triggered again, so that you can set a mark on your own when the business calls are successful.

VI. More API

Other API for the use of the interface document:iOS SDK API

VII. Scenes presentation Demo

VIII.Technical Support

Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center