iOS SDK API
SDKInterface description
- JMLinkService,Include SDKAll interfaces
- 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];
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];
turn onCrashLog collection
- + (void)crashLogON;
- Interface description:
- turn onCrashLog collection, turned off by default
- Call example
[JMLinkService crashLogON];
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
- response The data returned by the callback, please view the details JMLinkResponsekind
Call example:
[JMLinkService registerHandler:^(JMLinkResponse * _Nullable respone) {
//处理回调
}];
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) {
//处理回调
}];
Scheme Jump route
When
APPis passedschememethod, will trigger the system methodapplication:openURL: sourceApplication: annotation:, please call within this system methodSDKofrouteMLinkmethod.
+ (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];
}
universal link routing
When
APPis passeduniversal linkmethod, will trigger the system methodapplication: continueUserActivity:restorationHandler:, please call within this system methodSDKofcontinueUserActivitymethod.
+ (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];
}
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 |