Menu

iOS SDK

1. Function Overview

       In order to reduce the trouble for developers to update the application version frequently, the SolarEngine introduces online parameter functionality. By delivering parameters, the values of parameters in the application can be adjusted remotely at any time, allowing for application content updates without requiring a new release.

2. Obtain SDK

       https://solar-sdk.oss-cn-beijing.aliyuncs.com/iOS/SolarEngine-iOS-RC-Plugin-v1.2.6.0.zip

CocoaPods Integrated SDK

pod 'SESDKRemoteConfig' , '~> 1.3.0.3'

3. SDK Initialization

       Since the Parameter Delivery SDK is a plugin of the SolarEngine SDK, the initialization of the Parameter Delivery SDK depends on the SolarEngine SDK. Please refer to the Android SDK integration documentation for specific details.

Method example:

#import <SolarEngineSDK/SolarEngineSDK.h>
#import <SESDKRemoteConfig/SESDKRemoteConfig.h>

SEConfig *config = [[SEConfig alloc] init];
    
SERemoteConfig *remoteConfig = [[SERemoteConfig alloc] init];
remoteConfig.enable = YES;
config.remoteConfig = remoteConfig;
[[SolarEngineSDK sharedInstance] startWithAppKey:your_appKey userId:your_userId_SolarEngine config:config];

SERemoteConfig parameter introduction:

Parameter NameParameter MeaningParameter Type
enableWhether to send initialization parameters to the SDK (Default false)boolean
mergeTypeServer and SDK merge type (For details, please refer to the explanation below)enum
customIDPropertiesCustom ID, matches the custom ID set by the user in the backgroundJSONObject
customIDEventPropertiesCustom ID event property value, matches the custom ID event attribute value set by the user in the background.JSONObject
customIDUserPropertiesCustom ID user property value, matches the user attribute value set by the user in the background.JSONObject

Introduction to mergeType (merge strategy):

Parameter NameParameter Meaning
SERCMergeTypeDefault Use the server configuration to merge with the user's local cache configuration.
SERCMergeTypeUserWhen the app is launched for the first time or the version is updated, use the server configuration to merge with the user's default configuration. This method can clear the local cache configuration.


4. Set Default Configuration

       Developers who use parameters to deliver the SDK need to preset a default configuration into the App through the API. The SDK uses this default configuration as an alternative.

Method example:

- (void)setDefaultConfig:(NSArray *)defaultConfig;
Parameter NameParameter MeaningParameter TypeMandatory
defaultConfigThe default configuration passed by the developerNSArrayYes

Call example:

#import <SESDKRemoteConfig/SESDKRemoteConfig.h>


// defaultConfig default configuration. Each parameter configuration is a dictionary, formatted as follows:
//   [
//    {
//          @"name" : @"k1", // Name of the configuration item, corresponding to the parameter key of the fastFetchRemoteConfig interface
//          @"type" : @1, // Type of the configuration item: 1 for string, 2 for integer, 3 for boolean, 4 for json
//          @"value" : @"v1", // Value of the configuration item
//   }
//  ]

NSArray *defaultConfig = @[
    @{
        @"name":@"key1",
        @"value":@"value2",
        @"type":@1
    },
    @{
        @"name":@"key2",
        @"value":@"value2",
        @"type":@1
    }
];
[[SESDKRemoteConfig sharedInstance] setDefaultConfig:defaultConfig];
    

5. Set Custom Event Properties

       Developers can set custom attributes for events, and the parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

- (void)setRemoteConfigEventProperties:(NSDictionary *)properties;
Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom event propertiesNSDictionaryYes

Call example:

#import <SESDKRemoteConfig/SESDKRemoteConfig.h>

NSDictionary *properties = @{
        @"event_key1":@"event_value1",
        @"event_key2":@"event_value1"
    };
[[SESDKRemoteConfig sharedInstance] setRemoteConfigEventProperties:properties];
    

Note:

      Please do not pass in custom event properties with keys starting with an underscore "_". The SDK will discard such properties by default.

6. Set custom user properties

       Developers can set custom attributes for users. The parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

- (void)setRemoteConfigUserProperties:(NSDictionary *)properties;
Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom user propertiesNSDictionaryYes

Call example:

#import <SESDKRemoteConfig/SESDKRemoteConfig.h>

NSDictionary *properties = @{
        @"event_key1":@"event_value1",
        @"event_key2":@"event_value1"
    };
[[SESDKRemoteConfig sharedInstance] setRemoteConfigUserProperties:properties];

Note:

      Please do not pass in custom user properties with keys starting with an underscore "_". The SDK will discard such properties by default.

7. Obtain Parameter Delivery Configuration

       The parameter delivery SDK provides two methods for retrieving parameter configuration: synchronous and asynchronous.

  • Synchronous: Developers can directly obtain the result by calling the corresponding method.
  • Asynchronous: The result needs to be obtained after the callback is completed.

Note:

      When retrieving parameters synchronously or asynchronously, the SDK will trigger an event to report which experiment the user is assigned to. Therefore, it is recommended to retrieve parameters when the user reaches the experimental scenario (retrieving parameters signifies that the user has reached the experimental scenario and entered the experiment associated with that parameter). Please refrain from retrieving parameters prematurely.

7.1. Synchronously obtain parameter delivery configurations

Method example:

- (id)fastFetchRemoteConfig:(NSString *)key;

Parameter related:

Parameter NameParameter MeaningParameter TypeMandatory
keyParameter delivery key, corresponds to the parameter key configured by the user in the background.NSStringYes

Return value type: id

Call example:

#import <SESDKRemoteConfig/SESDKRemoteConfig.h>

id data = [[SESDKRemoteConfig sharedInstance] fastFetchRemoteConfig:@"key1"];
if ([data isKindOfClass:[NSString class]]) {
      NSString *dataString = (NSString *)data;
}

7.2.  Asynchronously obtain parameter delivery configurations

Method example:

- (void)asyncFetchRemoteConfig:(NSString *)key
             completionHandler:(void (^)(id data))completionHandler;
Parameter NameParameter MeaningParameter TypeMandatory
keyParameter delivery key, corresponds to the parameter key configured by the user in the background.NSStringYes
completionHandlerParameter delivery asynchronous callbackBlockYes

Call example

#import <SESDKRemoteConfig/SESDKRemoteConfig.h>

[[SESDKRemoteConfig sharedInstance] asyncFetchRemoteConfig:@"key1" completionHandler:^(id  _Nonnull data) {

      if ([data isKindOfClass:[NSString class]]) {
            NSString *dataString = (NSString *)data;
        }
}];

7.3. Synchronously obtain all parameter delivery configurations

Method example:

- (NSDictionary *)fastFetchRemoteConfig ;

Call example

#import <SESDKRemoteConfig/SESDKRemoteConfig.h> 
 NSDictionary *allData = [[SESDKRemoteConfig sharedInstance] fastFetchRemoteConfig];

7.4. Asynchronously obtain all parameter delivery configurations

Method example:

- (void)asyncFetchRemoteConfigWithCompletionHandler:(void (^)(NSDictionary *dict))responseHandle

Call example:

#import <SESDKRemoteConfig/SESDKRemoteConfig.h> 
[[SESDKRemoteConfig sharedInstance] asyncFetchRemoteConfigWithCompletionHandler:^(NSDictionary * _Nonnull dict) {

 }];


Example: Set Default Configuration

       Here is an example of a configuration in JSON string format:

       When the value is a dictionary or nested JSON string, please convert the JSON string to string.

Raw data

{
  "status": 0,
  "data": {
    "user_data": {
      "nick_name": "哈哈哈",
      "account_id": "123456",
      "title": "我是谁"
    }
  }
}


Data set to SDK

"{\"status\":0,\"data\":{\"user_data\":{\"nick_name\":\"哈哈哈\",\"account_id\":\"123456\",\"title\":\"我是谁\"}}}"


Set default data example

  NSArray *defaultConfig = @[
        @{
                @"name": @"key6",
                @"type": @1,
                @"value": @"{\"status\":0,\"data\":{\"user_data\":{\"nick_name\":\"哈哈哈\",\"account_id\":\"123456\",\"title\":\"我是谁\"}}}",
              }
   ];    
   [[SESDKRemoteConfig sharedInstance] setDefaultConfig:defaultConfig];


Value example

NSString *value = [[SESDKRemoteConfig sharedInstance] fastFetchRemoteConfig:@"key6"];
NSLog(@"fastFetchRemoteConfig value = %@",value);
// 打印出json字符串    {"status":0,"data":{"user_data":{"nick_name":"哈哈哈","account_id":"123456","title":"我是谁"}}}
NSData *jsonData = [value dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
if (error) {
  //解析出错
} else {
    NSLog(@"dic = %@",dic); 
    // 打印出字典对象
    // {
    // data =     {
    //     "user_data" =         {
    //        "account_id" = 123456;
    //        "nick_name" = "哈哈哈";
    //        title = "我是谁";
    //   };
    // };
    // status = 0;
}   
    NSLog(@"nick_name = %@",dic[@"data"][@"user_data"][@"nick_name"]);
    // 打印出 nick_name = 哈哈哈
}

————————————

SDK Update Log

2025-07-03 1.3.0.3

Align SolarEngineSDK 1.3.0.3


2025-06-12 1.3.0.2

Align SolarEngineSDK1.3.0.2


2025-01-17 1.2.9.4

Optimize the JSON configuration of online parameters


2024-12-10 1.2.9.3

Align SolarEngineSDK 1.2.9.3


2024-11-21 1.2.9.2

Align SolarEngineSDK 1.2.9.2


2024-11-06 1.2.9.1

Align SolarEngineSDK 1.2.9.1


2024-10-22 1.2.9.0

  • Align SolarEngineSDK Domestic Version 1.2.9.0 (please continue using 1.2.8.2 for the International Version)
    • Optimize network requests


2024-09-20 1.2.8.2

Align SolarEngineSDK 1.2.8.2



2024-09-10 1.2.8.1

Align SolarEngineSDK 1.2.8.1

  • Add SDK uninitialized check to the API


2024-08-16 1.2.8.0

Align SolarEngineSDK 1.2.8.0


2024-07-11 1.2.7.8

Align SolarEngineSDK 1.2.7.8


2024-07-02 1.2.7.7

Align SolarEngineSDK 1.2.7.7


2024-05-13 1.2.7.6

Align SolarEngineSDK 1.2.7.6


2024-04-23 1.2.7.5

Align SolarEngineSDK 1.2.7.5


2024-04-9 1.2.7.4

Align SolarEngineSDK 1.2.7.4


2024-04-9 1.2.7.3

Align SolarEngineSDK 1.2.7.3


2024-04-01 1.2.7.2

Align SolarEngineSDK 1.2.7.2


2024-03-06 1.2.7.1

Align SolarEngineSDK 1.2.7.1


2024-02-02 1.2.7.0

Request parameter configuration optimization.


2023-12-28 1.2.6.1

Align SolarEngineSDK 1.2.6.1


2023-12-14 1.2.6.0

Align SolarEngineSDK 1.2.6.0

  • Supports synchronous acquisition of all online parameter configurations
  • Asynchronously obtain all online parameter configurations


2023-11-21 1.2.5.3

Align SolarEngineSDK 1.2.5.3


2023-10-30 1.2.5.1

Align SolarEngineSDK 1.2.5.1


2023-10-12 1.2.5.0

Align SolarEngineSDK 1.2.5.0


2023-10-08 1.2.4.0

Align SolarEngineSDK 1.2.4.0


2023-08-25 1.1.1.1

Depends on SolarEngineSDK 1.2.3.0

  • Optimize the default configuration of online parameters


2023-07-31 1.1.1.0

Depends on SolarEngineSDK 1.2.2.0

  • Optimize the offload event logic


2023-06-01 1.1.0.0

Depends on SolarEngineSDK 1.2.0.0

  • Add setting function


2023-04-26 1.0.3.0

  • SDK log function optimization

2023-03-30 1.0.2.0

  • Internal function optimization and compatibility with debug mode


2023-03-20 1.0.1.0

  • Support AB testing function


2023-03-10 1.0.0.1

  • Add log management for parameter distribution

2023-02-08 1.0.0.0

  • Parameter distribution iOS SDK first version


Previous
Android SDK
Next
Web SDK
Last modified: 2025-07-29Powered by