iOS SDK API

Last updated:2023-8-16
Expand all
iOS SDK API

SDKInterface description

  1. JMLinkService,Include SDKAll interfaces
  2. JMLinkConfigClass, application configuration information class

initialization

  • + (void)setupWithConfig:(JMLinkConfig * )config;

  • Interface description:

  • Initialize interface. If the user does not need to perform privacy authorization, it is recommended toLaunchonCreateCall; if user authorization is required, authorize it first, and then call it after the user agrees.

  • Parameter description

  • config Configuration class

  • Call example:

// 如需使用 IDFA 功能请添加此代码并在初始化配置类中设置 advertisingId NSString *idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; JMLinkConfig *config = [[JMLinkConfig alloc] init]; config.appKey = @"AppKey copied from JiGuang Portal application"; config.advertisingId = idfaStr; [JMLinkService setupWithConfig:config];
          // 如需使用 IDFA 功能请添加此代码并在初始化配置类中设置 advertisingId
NSString *idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];     
JMLinkConfig *config = [[JMLinkConfig alloc] init];
config.appKey = @"AppKey copied from JiGuang Portal application";
config.advertisingId = idfaStr;
[JMLinkService setupWithConfig:config]; 

        
This code block is shown in the floating window

set updebugmodel

  • + (void)setDebug:(BOOL)enable;
  • Interface description:
  • turn ondebugmode, you can turn it on to view logs during development, and it is recommended to turn it off when preparing to submit it online.
  • Parameter description
  • enable Whether to turn ondebugmodel
  • Call example
[JMLinkService setDebug:YES];
          [JMLinkService setDebug:YES];

        
This code block is shown in the floating window

turn onCrashLog collection

  • + (void)crashLogON;
  • Interface description:
  • turn onCrashLog collection, turned off by default
  • Call example
[JMLinkService crashLogON];
          [JMLinkService crashLogON];

        
This code block is shown in the floating window

Get parameters

Get the parameters for pulling up a chain and restoring the scene.

  • + (void)registerHandler:(void(^_Nonnull)(JMLinkResponse *__nullable respone))handler;

  • Interface description:

  • Register a general callback to obtain parameters, which can obtain chain pull-up and scene restoration parameters.

  • Parameter description

  • handler callback block

  • Call example:

[JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) { //处理回调 }];
          [JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) {
 //处理回调
 }];

        
This code block is shown in the floating window

Get uncoded invitation parameters

  • + (void)getMLinkParam:(NSString *)paramKey handler:(void (^)(NSDictionary *params))handler;

  • Interface description:

  • Get the relevant values ​​returned from the uncoded invitation

  • Parameter description:

  • handler result callback

  • params Related fields

  • Call example:

[JMLinkService getMLinkParam:@"mlink key" handler:^(NSDictionary * _Nullable) { //处理回调 }];
          [JMLinkService getMLinkParam:@"mlink key" handler:^(NSDictionary * _Nullable) {
 //处理回调
}];

        
This code block is shown in the floating window

Scheme Jump route

When APP is passed scheme method, will trigger the system method application:openURL: sourceApplication: annotation:, please call within this system method SDK of routeMLink method.

  • + (BOOL)routeMLink:(NSURL *)url;

  • Interface description:

  • please application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation call in

  • Parameter description:

  • url Mlink URL

  • Call example:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{ return [JMLinkService routeMLink:url]; }
          - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
    return [JMLinkService routeMLink:url];
}

        
This code block is shown in the floating window

When APP is passed universal link method, will trigger the system method application: continueUserActivity:restorationHandler:, please call within this system method SDK of continueUserActivity method.

  • + (BOOL)continueUserActivity:(NSUserActivity *)userActivity;

  • Interface description:

  • please application:continueUserActivity:restorationHandler: call in

  • Parameter description:

  • userActivity Universal Link

  • Call example:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{ return [JMLinkService continueUserActivity:userActivity]; }
          - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{
 return [JMLinkService continueUserActivity:userActivity];
}

        
This code block is shown in the floating window

JMLinkConfigkind

Application configuration information class. The following is a description of the properties:

Parameter name Parameter type Parameter description
AppKey NSString Jiguang System application unique identifier, required
channel NSString Application release channel, optional
advertisingId NSString Advertising identifier, optional
isProduction BOOL Whether it is a production environment. If it is in development status, set it to NO; if it is production status, it should be changed toYES. Optional, default is NO

JMLinkResponse kind

The information class returned by the callback when a chain is pulled up and the scene is restored. The following is the attribute description:

Parameter name Parameter type Parameter description
url NSURL Pull up or restore the scene url, may be empty
params NSDictionary Parameters for pulling up or scene restoration, which may be empty
source JMLDataSource Data source type
eventType JMLEventType time type
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