iOS SDK API

Last updated:2023-11-03
Expand all
iOS SDK API

SDK Interface Description

  1. JOPERATEService,include SDK All interfaces.
  2. JOPERATEConfig, apply the configuration information class.
  3. JOPERATEUserID, user identification model.
  4. JOPERATEEventObject, Customises the object of the event.
  5. JOPERATEUserChannel, the user channel model.
  6. JOperateCollectControl, Data Collection Configuration Category.

SDK Initialize

Supported Version

description2.0.7

Interface definition

  • + initialize SDK;
  • Interface description:
  • Initialization interface.

Call Example

[JOPERATEService initialize SDK];
          
 [JOPERATEService initialize SDK];

        
This code block is shown in the floating window

SDK Initialization (Cancelled)

Supported Version

description 2.0.0 description2.0.7

Interface definition

  • + setupWithConfig:(JOPERATEConfig * )config;
  • Interface description:
  • Initialise Interface
  • Parameter Description
  • config Configure Class

Call Example

JOPERATEConfig *config = [[JOPERATEConfig alloc] init]; config. appKey = @"your appkey"; config. advertisingId = idfaStr; [JOPERATEService setupWithConfig:config];
          
 JOPERATEConfig *config = [[JOPERATEConfig alloc] init];
 config. appKey = @"your appkey";
 config. advertisingId = idfaStr;
 [JOPERATEService setupWithConfig:config];

        
This code block is shown in the floating window

Start business function

Supported Version

description 2.0.7

Interface definition

  • + operationStart:(JOPERATEConfig * )config;
  • Interface description:
  • Activate behavioral analysis anduser profileInterface.
  • Call the initial interface before you call it. initialize SDK.
  • operationStartThe interface is the start-up interface for the other interfaces, so you have to call first. operationStartInterface to call other interfaces
  • Parameter Description
  • config Configure Class

Call Example

JOPERATEConfig *config = [[JOPERATEConfig alloc] init]; config. appKey = @"your appkey"; config. advertisingId = idfaStr; [JOPERATEService operationStart:config];
          
 JOPERATEConfig *config = [[JOPERATEConfig alloc] init];
 config. appKey = @"your appkey";
 config. advertisingId = idfaStr;
 [JOPERATEService operationStart:config];

        
This code block is shown in the floating window

Settings Debug Mode

Supported Version

description 2.0.0

Interface definition

  • +  (void)setDebug:(BOOL)enable;
  • Interface description:
  • Open debug Mode
  • Parameter Description
  • enable Whether to open debug Mode

Call Example

[JOPERATEService setDebug:YES];
           [JOPERATEService setDebug:YES];

        
This code block is shown in the floating window

Custom Event Statistics

Before calling this interface, you need to create it on the consolemeta-event, details Createmeta-event.

Supported Version

description 2.0.0

Interface definition

  • + (void)eventRecord:(JOPERATEEventObject * )event;
  • Interface description:
  • Custom Event Statistics
  • Parameter Description
  • event Reported Custom Event Model

Call Example

JOPERATEEventObject *e = [[JOPERATEEventObject alloc] init]; e. eventName = @"eventID1"; e. property = @{@"key":@"key", @"user":@"user", @"add":@1}; [JOPERATEService eventRecord:e];
           JOPERATEEventObject *e = [[JOPERATEEventObject alloc] init];
 e. eventName = @"eventID1";
 e. property = @{@"key":@"key", @"user":@"user", @"add":@1};
 [JOPERATEService eventRecord:e];

        
This code block is shown in the floating window

Set User Contacts

Supported Version

description 2.0.0

Interface definition

  • + (void)setUserChannel:(JOPERATEUserChannel * )channel;
  • Interface description:
  • Set a "contact" for the user to specify the Contact Tab under Channel ID.
  • Initial contact label name is "Default Contact" and setting a custom name requires addition to the platform interface first Contact Tags.-Notsupported.-SettingsAPPThevalue of the "contact label" for notification must be the user's Registration ID.- When setting the "SMS Contact Tab" value must be 11 digit (cell phone number format)
  • Parameter Description
  • channel User Reaching Channel ID
  • Structure as {channel id:{contact label: contact }

Call Example

JOPERATEUserChannel *channel = [[JOPERATEUserChannel alloc] init]; channel. channels = @{@"通道ID": @{@"联系标签":@"联系方式"}}; channel. completion = ^(NSInteger errcode, NSString * _Nonnull msg) { }; [JOPERATEService setUserChannel:channel];
           JOPERATEUserChannel *channel = [[JOPERATEUserChannel alloc] init];
 channel. channels = @{@"通道ID": @{@"联系标签":@"联系方式"}};
 channel. completion = ^(NSInteger errcode, NSString * _Nonnull msg) { };
 [JOPERATEService setUserChannel:channel];

        
This code block is shown in the floating window

Set User ID

Supported Version

description 2.0.0

Interface definition

  • + (void)identifyAccount:(JOPERATEUserID * )userID;
  • Interface description:
  • Set User ID
  • Parameter Description
  • userID User identification model

Call Example

JOPERATEUserID *userID = [[JOPERATEUserID alloc] init]; userID. userIDs = @{@"loginID": @"value"}; [JOPERATEService identifyAccount:userID];
           JOPERATEUserID *userID = [[JOPERATEUserID alloc] init];
 userID. userIDs = @{@"loginID": @"value"};
 [JOPERATEService identifyAccount:userID];

        
This code block is shown in the floating window

Access CUID

Supported Version

description 2.0.0

Interface definition

  • + (NSString * )CUID;
  • Interface description:
  • Access to business growth CUID

Call Example

[JOPERATEService CUID];
           [JOPERATEService CUID];

        
This code block is shown in the floating window

Settings UTM Properties

Supported Version

description 2.0.0

Interface definition

  • + (void)setUtmProperties:(NSDictionary * )property;
  • Interface description:
  • UTM Properties are preset properties, which can currently be set UTM Properties are:
  • utm_source Sources of advertising series
  • utm_medium Advertising series media
  • utm_term Advertising Words
  • utm_content Advertising series content
  • utm_campaign Advertising series name

Call Example

[JOPERATEService setUtmProperties:@{@"utm_source":@"value"}];
               [JOPERATEService setUtmProperties:@{@"utm_source":@"value"}];

        
This code block is shown in the floating window

Set static public attributes

Supported Version

description 2.0.0

Interface definition

  • + (void)setCommonProperties:(NSDictionary * )property;
  • Interface description:
  • Sets the static public property, which will be included in all subsequent reported event data, which will be stored locally and set to be valid for long periods.
  • Event properties overwhelm public attributes when the event properties and public attributes overlap.
  • key Yes NSString, only the lowercase letters of a number can be underlined and start with the letter.
  • value It could be. NSString/NSNumber/NSSet, NSArray.
  • NSSet, NSArray All elements must be NSString.

Call Example

[JOPERATEService setCommonProperties:@{@"key":@"value"}];
               [JOPERATEService setCommonProperties:@{@"key":@"value"}];

        
This code block is shown in the floating window

Set dynamic public attributes

Supported Version

description 2.0.0

Interface definition

  • + (void)setDynamicCommonProperties:(NSDictionary<NSString *, id> *(^)(void)) dynamicProperties;
  • Interface description:
  • Sets the dynamic public property, and all post-incident data will contain the property returned by the interface, which is valid only on a current basis.
  • The event properties > dynamic public properties > static public properties are covered by the following priority when the event properties and public and dynamic public attributes repeat.
  • key Yes NSString, only the lowercase letters of a number can be underlined and start with the letter.
  • value It could be. NSString/NSNumber/NSSet, NSArray.
  • NSSet, NSArray All elements must be NSString.
  • dynamicProperties block returns the dynamic public attributes of the event.

Call Example

[JOPERATEService setDynamicCommonProperties:^NSDictionary<NSString *,id> * _Nonnull{ return @{@"key":@"value"}; }];
               [JOPERATEService setDynamicCommonProperties:^NSDictionary<NSString *,id> * _Nonnull{
 return @{@"key":@"value"};
 }];

        
This code block is shown in the floating window

Remove a static public attribute

Supported Version

description 2.0.0

Interface definition

  • + (void)unregisterCommonProperty:(NSString * )key;
  • Interface description:
  • Remove a static public attribute

Call Example

[JOPERATEService unregisterCommonProperty:@"key"];
               [JOPERATEService unregisterCommonProperty:@"key"];

        
This code block is shown in the floating window

Remove all static public attributes

Supported Version

description 2.0.0

Interface definition

  • + (void)clearCommonProperties;
  • Interface description:
  • Remove all current static public attributes

Call Example

[JOPERATEService clearCommonProperties];
               [JOPERATEService clearCommonProperties];

        
This code block is shown in the floating window

Fetch static public attributes

Supported Version

description 2.0.0

Interface definition

  • + (NSDictionary * )currentCommonProperties;
  • Interface description:
  • Copy of current static public properties

Call Example

NSDictionary* properties = [JOPERATEService currentCommonProperties];
              NSDictionary* properties = [JOPERATEService currentCommonProperties];

        
This code block is shown in the floating window

Set User Properties

Before calling this interface, create user attributes on the console, for more information Create User Properties.

Set User Properties for Overwrite

  • + (void)set:(NSDictionary * )userinfo completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • The content of these user properties is in one NSDictionary To store, of course. key It's the name of the user attribute, which must be NSString, Value is the content of the user attribute only supported NSString, NSNumber, NSSet, NSArray These types.
  • NSSet Or... NSArray Type value Only elements currently supported are NSString.
  • If a certain user attribute already exists, this time it will be overridden; if it does not exist, it will be created. For example: user membership.
  • Call Example:
[JOPERATEService set:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService set:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window
  • + (void)set:(NSString * )key to:(id)value completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • Sets the content of the user's individual user attribute.
  • The content of these user properties is in one NSDictionary To store, of course. key It's the name of the user attribute, which must be NSString, Value is the content of the user attribute only supported NSString, NSNumber, NSSet, NSArray These types.
  • NSSet Or... NSArray Type value Only elements currently supported are NSString.
  • If a certain user attribute already exists, this time it will be overridden; if it does not exist, it will be created. For example: user membership.
  • Call Example:
[JOPERATEService set:@"key" to:@"value" completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService set:@"key" to:@"value" completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Set user properties valid only for the first time

  • + (void)setOnce:(NSDictionary * )userinfo completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • with set Differently, an interface is created if one of the user properties of the user already exists before it is ignored; it does not exist. For example: time of first payment.
  • Call Example:
[JOPERATEService setOnce:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService setOnce:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Set cumulative user properties

  • + (void)increment:(NSString * )key by:(NSNumber * )amount completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • Add a value to the user attribute of a numerical type, adding all reported data, such as the cumulative amount of consumption.
  • Only right. NSNumber Type user attribute calls this interface, otherwise it will be ignored, and if this user attribute does not exist before, the initial value will be treated as 0.
  • Call Example:
[JOPERATEService increment:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService increment:@{@"key":@"value"} completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window
  • + (void)increment:(NSDictionary * )userinfo completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • Add value to user attributes of multiple value types, adding all reported data, such as cumulative consumption amounts.
  • Only right. NSNumber Type user attribute calls this interface, otherwise it will be ignored, and if this user attribute does not exist before, the initial value will be treated as 0.
  • Call Example:
[JOPERATEService increment:@{@"key":@1} completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService increment:@{@"key":@1} completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Set User Properties for Adding Method

  • + (void)append:(NSString * )key by:(NSObject * )content completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • To One NSSet Or... NSArray Type properties add some values.
  • As stated earlier, this... NSSet Or... NSArray The elements must be NSString, otherwise, it'll be ignored, while, if append............................................................. NSSet Or... NSArray.
  • Sustainable addition of the assembly elements, which enter the library to reprocess if they existABC, Add CD, and eventuallyABCD, like the news of the user.
  • Call Example:
[JOPERATEService append:@"key" by:@[@"value"] completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService append:@"key" by:@[@"value"] completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Remove User Properties

Supported Version

description 2.0.0

Interface definition

  • + (void)unset:(NSString * )key completion:(void (^)(NSInteger errcode, NSString * msg))completion;
  • Interface description:
  • Remove all contents of a user attribute
  • If this user attribute does not exist before, ignore it directly

Call Example

[JOPERATEService unset:@"key" completion:^(NSInteger errcode, NSString * _Nonnull msg) { }];
           [JOPERATEService unset:@"key" completion:^(NSInteger errcode, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Time events segment

Start Event Time

  • + (nullable NSString * )timeKeepingEventStart:(NSString * )event;
  • Interface description:
  • If you need to measure the duration of an event, call at the beginning of the event timeKeepingEventStart:The "incident name" records the start of the event, and the method does not really send the event.
  • Then at the end of the incident, call timeKeepingEventEnd:Event ID with:properties.
  • Call Example:
NSString *eventID = [JOPERATEService timeKeepingEventStart:@"key"];
           NSString *eventID = [JOPERATEService timeKeepingEventStart:@"key"];

        
This code block is shown in the floating window

End Event Time

  • + (void)timeKeepingEventEnd:(NSString * )eventId with:(nullable NSDictionary * )properties;
  • Interface description:
  • Ending event timed, multiple calls, first call based
  • Call Example:
[JOPERATEService timeKeepingEventEnd:eventID with:@{@"key":@"value"}];
           [JOPERATEService timeKeepingEventEnd:eventID with:@{@"key":@"value"}];

        
This code block is shown in the floating window

Pause Event Timing

  • + (void)timeKeepingEventPause:(NSString * )eventId;
  • Interface description:
  • When called repeatedly, the first call will be based on
  • Call Example:
[JOPERATEService timeKeepingEventPause:eventID];
           [JOPERATEService timeKeepingEventPause:eventID];

        
This code block is shown in the floating window

Restore Event Time

  • + (void)timeKeepingEventResume:(NSString * )eventId;
  • Interface description:
  • When called repeatedly, the first call will be based on
  • Call Example:
[JOPERATEService timeKeepingEventResume:eventID];
           [JOPERATEService timeKeepingEventResume:eventID];

        
This code block is shown in the floating window

Delete Event Time

  • + (void)removeTimeKeepingEvent:(NSString * )eventId;
  • Interface description:
  • Only first call is valid when called repeatedly
  • Call Example:
[JOPERATEService removeTimeKeepingEvent:eventID];
           [JOPERATEService removeTimeKeepingEvent:eventID];

        
This code block is shown in the floating window

Clear all time events

  • + (void)clearTimeKeepingEvent;
  • Interface description:
  • Clear all time events
  • Call Example:
[JOPERATEService clearTimeKeepingEvent];
           [JOPERATEService clearTimeKeepingEvent];

        
This code block is shown in the floating window

Demo Interface

Access to operational growth readiness

  • + (void)isValid:(void (^)(NSInteger code, NSString * msg))completion;
  • Interface description:
  • Have your projects started to grow?code Open for 0 bits.
  • Call Example:
[JOPERATEService isValid:^(NSInteger code, NSString * _Nonnull msg) { }];
           [JOPERATEService isValid:^(NSInteger code, NSString * _Nonnull msg) {
 
 }];

        
This code block is shown in the floating window

Access to user data

  • + (void)userData:(void (^)(NSInteger code, NSDictionary<NSString *,  id> * data))completion;
  • Interface description:
  • Callbacking to user data such as back-office registered user events, current user channel information, user identification, etc.
  • Call Example:
[JOPERATEService userData:^(NSInteger code, NSDictionary<NSString *,id> * _Nonnull data) { }];
           [JOPERATEService userData:^(NSInteger code, NSDictionary<NSString *,id> * _Nonnull data) {
 
 }];

        
This code block is shown in the floating window

Access to project information

  • + (void)appInfo:(void (^)(NSInteger code, NSDictionary<NSString *,  id> * data))completion;
  • Interface description:
  • Callbacking to Project Information
  • Call Example:
[JOPERATEService appInfo:^(NSInteger code, NSDictionary<NSString *,id> * _Nonnull data) { }];
           [JOPERATEService appInfo:^(NSInteger code, NSDictionary<NSString *,id> * _Nonnull data) {
 
 }];

        
This code block is shown in the floating window

Data Acquisition Item Configuration

Supported Version

description 2.0.8

Interface definition

  • **+ (void)setCollectControl:(JOperateCollectControl )control;*
  • Interface description:
  • Data acquisition configuration. To ensure you use Jiguang Operations GrowthGood effect, we strongly recommend that you all collect.
  • Parameter description:
  • control: Data Acquisition Item Configuration Category. The corresponding parameter set to NO is not collected, the default isYES.

Call Example

JOperateCollectControl *control = [[JOperateCollectControl alloc] init]; control. wifi = YES; control. ssid = YES;... [JOPERATEService setCollectControl:control];
           JOperateCollectControl *control = [[JOperateCollectControl alloc] init];
 control. wifi = YES;
 control. ssid = YES;...
 [JOPERATEService setCollectControl:control];

        
This code block is shown in the floating window

JOPERATEConfig Category

Applys the configuration information class. The following are the attributes:

Parameter Name Parameter Type Parameter Description
appKey NSString Jiguang system applies the only sign.
channel NSString Apply publication channels, options
advertisingId NSString Advertising identifier, optional
isProduction BOOL The production environment. If state of exploitation, set to NO; if state of production, read YES optional, default to NO

JOPERATEUserID Category

User identification model type. The following are the attributes:

Parameter Name Parameter Type Parameter Description
userIDs NSDictionary User identification dictionary
completion (^)(NSInteger errcode, NSString * msg) Callback result. errcode:0 For success.

JOPERATEEventObject Category

Customises the type of event object. All string properties cannot be longer 256 bytes (including extra Yes. key), the following is the description of the attribute:

Parameter Name Parameter Type Parameter Description
eventName NSString Event ID, mandatory, non-empty
property NSDictionary<NSString *, id> Custom Properties (< =500 a)key Yes NSString, which can only include a numerical letter underlining;value It could be. NSString/NSNumber

JOPERATEUserChannel Category

User channel model type. The following are the attributes:
If not set or set to nil Considers it unmodified, and emptys the channel when setting to an empty string

Parameter Name Parameter Type Parameter Description
channels NSDictionary Channel dictionary
completion (^)(NSInteger errcode, NSString * msg) Callback result. errcode:0 For success.

JOperateCollectControl Category

Data acquisition configuration class, ** to ensure you use Jiguang Operations GrowthGood effect, we strongly recommend that you all collect. **

Parameter Name Parameter Type Parameter Description
wifi BOOL WIFIInformation. Set to NO, Do Not CollectwifiInformation. Default asYES.
ssid BOOL SSIDInformation. Set to NO, Do Not CollectSSIDInformation. Default asYES.
bssid BOOL BSSIDInformation. Set to NO, Do Not CollectbssidInformation. Default asYES.
gps BOOL Longitude information. Set to NO without collecting longitude information. Default asYES.

Data validation mode

Helps developers or business students to see if the data statistics that have been set are successful.

Usage method

Enter debug page in developer backstage, in App Configure debugging page display scheme, and then open the application with the browser two-dimensional code to call SDK Interface enters the developer mode. After entering the developer mode, you can view the data of the current device in real time backstage.

  • + (void)openDebugMode:(NSURL *)url;
  • Interface description:
  • Enter data validation mode
  • Parameter Description
  • url Callback. urlYes. Appdelegate Yes. application:handleOpenURL:. Do not call this interface JOPERATE Not supported

Call Example

// 具体使用方法参考 demo - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {[JOPERATEService openDebugMode:url]; return YES; }
              // 具体使用方法参考 demo
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {[JOPERATEService openDebugMode:url];
 return YES;
}

        
This code block is shown in the floating window
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