Splunk MINT SDK for iOS (Legacy)

Splunk MINT SDK for iOS Developer Guide

Splunk MINT is no longer available for purchase as of January 29, 2021. Customers who have already been paying to ingest and process MINT data in Splunk Enterprise will continue to receive support until December 31, 2021, which is End of Life for all MINT products: App, Web Service (Management Console), SDK and Add-On.

Add Splunk MINT to your iOS project

To use the Splunk MINT SDK for iOS:

  1. Include the SplunkMint library umbrella header or module in every file where you use Splunk MINT.
  2. Import header:

    #import <SplunkMint/SplunkMint.h>

    Import module:

     @import SplunkMint;
  3. If you are using swift, Include the SplunkMint module in every file where you use Splunk MINT.
  4. Import module:

     @import SplunkMint;

Configuration options

Before you initialize the Splunk MINT SDK for iOS, you have several configuration options:

  • Set the application environment using the Mint.applicationEnvironment property. You can use a custom string or one of the following predefined application environments:
    • SPLAppEnvRelease
    • SPLAppEnvStaging
    • SPLAppEnvUserAcceptanceTesting
    • SPLAppEnvTesting
    • SPLAppEnvDevelopment

    For example:

    // Example 1
    [Mint sharedInstance].applicationEnvironment = @"my custom env";
    
    // Example 2
    Mint.sharedInstance().applicationEnvironment = SPLAppEnvUserAcceptanceTesting;
    

    You can then use the Environment filter in the MINT App to view data for a specific application environment.

  • Limit the number of lines to log. For details, see Report console log messages.
  • Disable crash reporting for a specific user, for example to improve memory allocation. For details, see Do not report data.
  • Disable network monitoring. For details, see Disable network monitoring for URLs.
  • Disable view monitoring. For details, see Track views.
  • Disable memory warnings. For details, see View memory warnings.
  • Enable battery level monitoring. For details, see Monitor the battery level of devices.
  • Set the User identifier. For details, see Report user-specific data.

Initialize the SDK when using the MINT Data Collector

When you send data from your mobile apps using the MINT Data Collector, initialize the Splunk MINT SDK for iOS with one line of code with your API key, preferably in the beginning of your application delegates application:didFinishLaunchingWithOptions. For more about getting an API key, see How do I use MINT Data Collector?.

// Objective-C

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[Mint sharedInstance] initAndStartSessionWithAPIKey:@"API_KEY"];
    // ...
   return true;
}
// Swift 

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{ 
   Mint.sharedInstance().initAndStartSessionWithAPIKey("API_KEY");
   return true;
} 

The initAndStartSessionWithAPIKey: method installs the MINT exception handler and the performance monitor, sends all the saved data to Splunk MINT, and starts a new session for the current user.

Notes
  • To have a better experience with the Splunk MINT dashboards, use numeric versioning schemes, preferably in MAJOR.MINOR.RELEASE format.
  • Do not use any other SDKs that perform error reporting with MINT. Conflicts might occur when multiple SDKs are active.

A variable for the crash controller is not required. The sharedInstance static class selector returns the singleton instance reference. You can also set this value to a property, which is recommended when you use the Mint class a lot in any file.

If you crash the app while debugging, the crash will not be reported. To report crashes, you must deploy the app to your device or simulator and then start it outside the debugging environment.

Initialize the SDK when using the HTTP Event Collector

When you send data from your mobile apps using the HTTP Event Collector, you'll need to get a HEC token and know the HEC URL for the MINT endpoint to initialize the Splunk MINT SDK for iOS. For more, see How do I use HTTP Event Collector with MINT?.

Initialize the SDK as follows:

// Objective C
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[Mint sharedInstance] initAndStartSessionWithHECUrl:@"HEC_URL" token:@"HEC_TOKEN"];
    // ...
   return true;
}
// Swift 

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{ 
   Mint.sharedInstance().initAndStartSessionWithHECUrl("HEC_URL", token: "HEC_TOKEN")
   return true;
} 
Last modified on 04 June, 2021
Configure your project for symbolication   Customize session handling

This documentation applies to the following versions of Splunk MINT SDK for iOS (Legacy): 5.2.x


Was this topic useful?







You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters