Using the iOS SDK
    • PDF

    Using the iOS SDK

    • PDF

    Article Summary

    Available in Classic and VPC

    This chapter describes how to use Effective Log Search & Analytics NELO iOS SDK.

    Effective Log Search & Analytics NELO iOS supports the following devices and OS.

    iPhone 3GS, 4, 4GS, 5, 5c, 5s, 6, 6 Plus, 6S, 6S Plus (armv7/armv7s/arm64)
    iOS 4.3 or later
    

    Download

    Latest release versions are provided in Fat binary format. iOS includes the i386 simulator and binary for the arm7 (armv7/armv7s/arm64) device architecture.

    API list

    "NeloLog" class provides the following APIs.

    // Default NeloLog init method
    + (bool) init:(NSString *)server onPort:(int)port ofProjectName:(NSString*)appName withProjectVersion:(NSString*)appVersion;
    + (bool) init:(NSString *)server onPort:(int)port ofProjectName:(NSString*)appName withProjectVersion:(NSString*)appVersion forUserId:(NSString*)userId;
    + (bool) init:(NSString *)server onPort:(int)port byProtocol:(NeloLogProtocol)protocol ofProjectName:(NSString*)appName withProjectVersion:(NSString*)appVersion forUserId:(NSString*)userId;
    
    // 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;
    
    + (void) setUserId:(NSString*)userId;
    + (void) setLogType:(NSString*)logType;
    + (void) setLogSource:(NSString*) logSource;
    + (void) setCrashBlock:(void (^)(void))block;
    + (void) setLogLevelFilter:(NSString*)logLevelFilter;
    + (void) setNeloSendMode:(NSString*)sendMode;
    
    + (void) enableClientSideSymbolication:(bool)enable;
    + (NSArray *) getReservedFields;
    + (NSDictionary *) getNeloSendMode;
    + (NSDictionary *) getNeloLogLevel;
    

    How to use NELO SDK

    Add Nelo SDK Framework

    1. Add NELO2SDK.framework and CrashReporter.framework to "Frameworks".

    elsa-1-4-2_en(2).png
    [Figure - NELO iOS SDK added to Framweorks]

    1. Add the following system framework to "Link Binary With Libraries" in "Build Phases".
    UIKit.framework
    SystemConfiguration.framework
    CoreTelephony.framework
    Foundation.framework
    

    elsa-1-4-3_en(2).png
    [Figure - System Framework added to Build Phases]

    API detailed description

    Initialization function

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

    From SDK Version 0.32, the onPort, byProtocol parameter has been removed.

    Parameters

    * server : The address of the collection server of Effective Log Search & Analytics (see Transport Server below)
    * appName : Project ID registered in Effective Log Search & Analytics
    * appVersion : The version of the App to be sent to Effective Log Search & Analytics. Use this version to map symbolic files during Symbolization.
    * userId : User's ID information
    Transport server

    iOS SDK sends logs using HTTPS protocol.

    • Collector server address
      • elsa-col.ncloud.com

    Log transfer

    // 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;
    

    Parameters

    • errorCode : Mapped to NELO errorCode field. Limited to length (128 characters).
    • message : Mapped to NELO body field. No Limited to length (Limited to full log capacity).
    • location : Mapped to NELO location field. The error occurrence location being delivered.

    How to use

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

    Other functions

    + (void) setUserId:(NSString*)userId;
    + (void) setLogType:(NSString*)logType;
    + (void) setLogSource:(NSString*) logSource;
    + (void) setCrashBlock:(void (^)(void))block;
    + (void) setLogLevelFilter:(NSString*)logLevelFilter;
    + (void) setNeloSendMode:(NSString*)sendMode;
    // Client Side Symbolication
    + (void) enableClientSideSymbolication:(bool)enable;
    

    setCrashBlock

    • Crash Callback function
    • If you write a code to be executed when a crash occurs in a block function, the code will be run and delivered upon crash transmission after the crash occurs.
      • Code example
        [NeloLog setCrashBlock:^{
            NSLog(@"crashed");
            [NeloLog setCustomField:@"MyValue" forKey:@"MyKey"];
        }];
        

    setLogLevelFilter

    • A function that sets a log level to send logs with a higher grade than a specific log level
    • Only the levels defined below can be set, and only the logs with levels above the set level are sent.
      • DEBUG < INFO < WARN < ERROR < FATAL
      • The value is defined by the constant value below.
        • NELO2_LOGLEVEL_DEBUG
        • NELO2_LOGLEVEL_INFO
        • NELO2_LOGLEVEL_WARN
        • NELO2_LOGLEVEL_ERROR
        • NELO2_LOGLEVEL_FATAL
    • The default value is DEBUG.
    • Code example
      [NeloLog setLogLevelFilter:NELO2_LOGLEVEL_WARN];
      

    setNeloSendMode

    • The IOS SDK supports the following transmission modes.
      • ALL: Send logs when connected to a network.
      • WIFI: Send logs only when connected to WIFI.
      • The default value is ALL

    enableClientSideSymbolication

    • Set whether the symbolication is performed on a client.
    • The default values are as follows.
      • IOS SDK: false (A client does not perform symbolication.)
      • MAC SDK: true (A client performs symbolication.)
    • When a client performs symbolication, there is a slight delay when an app is stopped in the event of a crash occurred.

    Effective Log Search & Analytics iOS SDK default usage example

    NSString* appID = @"02b96c3d8bbe_elsa-test";
    NSString* appVer= @"1.0.0";
    NSString* serverAddr = @"elsa-col.ncloud.com"; //Effective Log Search & Analytics collector server address
    int serverPort = 10006; //Effective Log Search & Analytics collector server port
    NSString* userID = @"tester"; //User ID
    
    
    // Nelo Init
    [NeloLog init:serverAddr onPort:serverPort ofProjectName:appID withProjectVersion:appVer forUserId:userID];
    
    // Send Nelo log
    [NeloLog info:@"ErrorCode" withMessage:@"Message"];
    [NeloLog error:@"ErrorCode" withMessage:@"Message" atLocation:@"test loc"];
    

    FAQ

    1. Where do I get dSYMs (Symbols) from my Bitcode enabled app?

    You can receive it from Xcode or iTunes Connect.

    • When using iTunes Connect to download Debug Symbols, select the desired version from the build list of apps under "My Apps". Select "Download dSYM" to download.

    Was this article helpful?

    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.