Customize session handling
By default, Splunk MINT uses the initAndStartSession: method and the time zone of our servers to calculate the time a user's session begins. However, you can customize session handling if you need to.
- Note When you close a session, it does not impact any other feature of the Splunk MINT plugin. The plugin will continue working properly and record network information, handled exceptions, events, and any crash that might occur.
Use the following methods to start, close, and flush sessions:
- To explicitly start the session, use the startSessionAsyncWithCompletionBlock: method. (If a previous session was initialized less than one minute earlier, this call is ignored.)
- To close the active session, use the closeSessionAsyncWithCompletionBlock: method.
- To manually flush all saved data, use the flushAsyncWithBlock: method.
- To only send data over a WiFi connection, use the enableFlushOnlyOverWiFi: method.
Example code
If there are logged handled exceptions, custom events, or any network interception captured by Splunk MINT and you don't want to wait for another initAndStartSession use the flushAsyncWithBlock: method to immediately send any logged requests to the Splunk server.
// Objective-C [[Mint sharedInstance] enableFlushOnlyOverWiFi:YES]; [[Mint sharedInstance] flushAsyncWithBlock:^(MintResponseResult *mintResponseResult) { if (mintResponseResult.resultState == OKResultState) { NSLog(@"Flush finished successfully."); } else { NSLog(@"Flush finished unsuccessfully."); } }];
// Swift Mint.sharedInstance().enableFlushOnlyOverWiFi(true) Mint.sharedInstance().flushAsyncWithBlock { (responseResult) -> Void in if (responseResult.resultState.rawValue == OKResultState.rawValue) { print("Flush finished successfully."); } else { print("Flush finished unsuccessfully."); } }
Add Splunk MINT to your iOS project | Monitor transactions |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (EOL): 4.1.x, 4.2.x, 4.3.x, 4.4.x
Feedback submitted, thanks!