- Print
- PDF
iOS SDK
- Print
- PDF
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.
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.
- In NAVER Cloud Platform's console, Create project.
- Check the txtToken value in Project detail page.
- Download SDK for iOS.
2. Install iOS SDK
The following describes how to install iOS SDK.
- Unzip the downloaded SDK file.
- Save the SDK file in the
Frameworks
folder of the iOS project where SDK is to be installed.- Nelo2SDK.framework
- CrashReporter.framework
- Run Xcode to open the project.
- Click the target to build in TARGETS.
- 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.
Parameter | Description |
---|---|
serverAddr | Log collecting server's address
|
appName | Project ID |
appVersion | The version information of the app to transfer logs
|
userId | User ID |
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.
Parameter | Description |
---|---|
errorCode | The value that is mapped to NELO's errorCode field (Length limit: 128 characters) |
message | The value that is mapped to NELO's body field (No length limit, but there is a total log capacity limit) |
location | The 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.
Parameter | Description |
---|---|
userId | User ID |
Set log type
Here are the APIs that set logType.
+ (void) setLogType:(NSString*)logType;
The following describes each parameter.
Parameter | Description |
---|---|
logType | logType 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.
Parameter | Description |
---|---|
block | Sets 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.
- 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.
Parameter | Description |
---|---|
logLevelFilter | Transfers 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.
Parameter | Description |
---|---|
sendMode | Set log transfer method |
The following shows the log transfer method by network, depending on the parameter setting value.
When setting to
ALL
Network status Transfer method 3g Transfer Wi-Fi Transfer Not Connected Not sent When setting to
WIFI
Network status Transfer method 3g Not sent Wi-Fi Transfer Not Connected Not sent
Set symbolication execution
Here are the APIs that set whether to execute symbolication at the client.
- 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.
- iOS SDK:
+ (void) enableClientSideSymbolication:(bool)enable;
The following describes each parameter.
Parameter | Description |
---|---|
enable | Sets whether to execute symbolication at the client |