iOS SDK
    • PDF

    iOS SDK

    • PDF

    Article Summary

    Available in Classic and VPC

    In iOS SDK, it describes how to use iOS SDK, which is provided by Effective Log Search & Analytics 2.0 service.

    Note

    iOS SDK uses HTTPS protocol to transfer logs.

    The following describes how to use SDK.

    1. Preparation
    2. Install SDK
    3. Use SDK

    1. Preparation

    The following describes the preparations for installing iOS SDK.

    1. In NAVER Cloud Platform's console, Create project.
    2. Check the txtToken value in Project detail page.
    3. Download SDK for iOS.

    2. Install iOS SDK

    The following describes how to install iOS SDK.

    1. Unzip the downloaded SDK file.
    2. Save the SDK file in the Frameworks folder of the iOS project where SDK is to be installed.
      • Nelo2SDK.framework
      • CrashReporter.framework
    3. Run Xcode to open the project.
    4. Click the target to build in TARGETS.
    5. Select Build Phases, and add the following system framework in the Link Binary With Libraries field.
      • UIKit.framework
      • SystemConfiguration.framework
      • CoreTelephony.framework
      • Foundation.framework

    3. Use SDK

    Refer to the following actual code examples that use Effective Log Search & Analytics 2.0 iOS SDK and transfer logs to the projects.

    NSString* appID = @"02b96c3d8bbe_elsa-test";
    NSString* appVer= @"1.0.0";
    NSString* serverAddr = @"elsa-v2-col.ncloud.com"; //Effective Log Search & Analytics collecting server's address
    NSString* userID = @"tester"; //userID
    
    // Nelo Init
    [NeloLog init:serverAddr ofProjectName:appID withProjectVersion:appVer forUserId:userID];
    
    // Nelo log transfer
    [NeloLog info:@"ErrorCode" withMessage:@"Message"];
    [NeloLog error:@"ErrorCode" withMessage:@"Message" atLocation:@"test loc"];
    

    iOS SDK API details

    iOS SDK provides the following APIs:

    Initialization API

    Here are the APIs that initialize.

    // Default NeloLog init method
    + (bool) init:(NSString *)serverAddr ofProjectName:(NSString*)appName withProjectVersion:(NSString*)appVersion;
    + (bool) init:(NSString *)serverAddr ofProjectName:(NSString*)appName withProjectVersion:(NSString*)appVersion forUserId:(NSString*)userId;
    

    The following describes each parameter.

    ParameterDescription
    serverAddrLog collecting server's address
    • Collector server address: elsa-col.ncloud.com
    appNameProject ID
    appVersionThe version information of the app to transfer logs
    • Mapping with the symbol file when symbolicating in this version
    userIdUser ID
    Note

    onPort and byProtocol parameters are deleted from SDK Version 0.32.

    <example>

    NSString* appID = @"02b96c3d8bbe_elsa-test";
    NSString* appVer= @"1.0.0";
    NSString* serverAddr = @"elsa-v2-col.ncloud.com"; //Effective Log Search & Analytics 2.0 collecting server's address
    NSString* userID = @"tester"; //userID
    
    // Nelo Init
    [NeloLog init:serverAddr ofProjectName:appID withProjectVersion:appVer forUserId:userID];
    

    Log transferring API

    Here are the APIs that transfer logs.

    // send log method
    + (void) debug:(NSString*)errorCode withMessage:(NSString*)message;
    + (void) error:(NSString*)errorCode withMessage:(NSString*)message;
    + (void) fatal:(NSString*)errorCode withMessage:(NSString*)message;
    + (void) info:(NSString*)errorCode withMessage:(NSString*)message;
    + (void) warn:(NSString*)errorCode withMessage:(NSString*)message;
    
    + (void) debug:(NSString*)errorCode withMessage:(NSString*)message atLocation:(NSString*)location;
    + (void) error:(NSString*)errorCode withMessage:(NSString*)message atLocation:(NSString*)location;
    + (void) fatal:(NSString*)errorCode withMessage:(NSString*)message atLocation:(NSString*)location;
    + (void) info:(NSString*)errorCode withMessage:(NSString*)message atLocation:(NSString*)location;
    + (void) warn:(NSString*)errorCode withMessage:(NSString*)message atLocation:(NSString*)location;
    

    The following describes each parameter.

    ParameterDescription
    errorCodeThe value that is mapped to NELO's errorCode field (Length limit: 128 characters)
    messageThe value that is mapped to NELO's body field (No length limit, but there is a total log capacity limit)
    locationThe value that is mapped to NELO's location field (Transfers the location where error occurs)

    <example>

    [NeloLog info:@"ErrorCode" withMessage:@"Message"];
    

    Option setting API

    Here are the Option setting APIs.

    Set user ID

    Here are the APIs that set user ID.

    + (void) setUserId:(NSString*)userId;
    

    The following describes each parameter.

    ParameterDescription
    userIdUser ID

    Set log type

    Here are the APIs that set logType.

    + (void) setLogType:(NSString*)logType;
    

    The following describes each parameter.

    ParameterDescription
    logTypelogType information

    Crash callback

    You can call the user-defined functions before sending the crash log when a crash occurs. Here are the crash callback APIs.

    + (void) setCrashBlock:(void (^) (void))block;
    

    The following describes each parameter.

    ParameterDescription
    blockSets the crash transfer method when an app crash occurs

    <example>

    [NeloLog setCrashBlock:^{
        NSLog(@"crashed");
        [NeloLog setCustomField:@"MyValue" forKey:@"MyKey"];
    }];
    

    Set loglevel

    Here are the APIs that transfer logs over the loglevel.

    Note
    • Uses functions by logLevel.
      • logLevel: Fatal, Error, Warn, Info, and Debug
    • The value is defined as the following constant value:
      • NELO2_LOGLEVEL_DEBUG (Default)
      • NELO2_LOGLEVEL_INFO
      • NELO2_LOGLEVEL_WARN
      • NELO2_LOGLEVEL_ERROR
      • NELO2_LOGLEVEL_FATAL
    + (void) setLogLevelFilter:(NSString*)logLevelFilter;
    

    The following describes each parameter.

    ParameterDescription
    logLevelFilterTransfers logs over logLevel to NELO

    <example>

    [NeloLog setLogLevelFilter:NELO2_LOGLEVEL_WARN];
    

    Set log transfer method

    Here are the APIs that set log transfer method.

    + (void) setNeloSendMode:(NSString*)sendMode;
    

    The following describes each parameter.

    ParameterDescription
    sendModeSet log transfer method

    The following shows the log transfer method by network, depending on the parameter setting value.

    • When setting to ALL

      Network statusTransfer method
      3gTransfer
      Wi-FiTransfer
      Not ConnectedNot sent
    • When setting to WIFI

      Network statusTransfer method
      3gNot sent
      Wi-FiTransfer
      Not ConnectedNot sent

    Set symbolication execution

    Here are the APIs that set whether to execute symbolication at the client.

    Note
    • The default settings value of SDK is as follows:
      • iOS SDK: false (Not executing symbolication task at the client)
      • mac SDK: true (Executing symbolication task at the client)
      • When executing the symbolication task at the client, a bit of delay occurs when the app stops if a crash occurs.
    + (void) enableClientSideSymbolication:(bool)enable;
    

    The following describes each parameter.

    ParameterDescription
    enableSets whether to execute symbolication at the client

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.