/
Implementation iOS
Implementation iOS
The following example shows the basic installation for the iOS platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
Please note!
At the application start the Spring object has to be instanced one-time and to be used for the whole life cycle of the application
/* * Importing SpringMobile */ #import "Spring.h" /* * Providing entity */ Spring *spring; /* * Generating SpringMobile entity with site id and * application name */ spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"]; /* * Sending the start of the application to the measurement system */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_STARTED,VAR_ACTION,nil]; [spring commit:dict]; ... // OR /* * Sending the action spring.BACKGROUND */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_BACKGROUND,VAR_ACTION,nil]; [spring commit:dict];
example: cp
/* * Importing SpringMobile */ #import "Spring.h" /* * Providing entity */ Spring *spring; /* * Generating SpringMobile entity with site id and application name */ spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"]; /* * Sending CP to the measurement system */ NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Mainpage",@"cp",nil]; [spring commit:dict]; ...
Timeout (default: 30 seconds)
With this value, a timeout (in seconds) for each HTTP request can be configured within the library.
Example:
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"]; spring.timeout = 30.0; // in seconds
Debug
If this value is set on YES
, the library provides debug outputs over the class NSLog
.
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"]; spring.debug = YES;
Output example:
2011-11-25 13:42:52.878 TestApp3[73923:ff07] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19;;;?lt=gvf6lykt 2011-11-25 13:42:52.927 TestApp3[73923:ff07] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:42:56.521 TestApp3[73923:1020b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m1e1 2011-11-25 13:42:56.559 TestApp3[73923:1020b] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:42:59.388 TestApp3[73923:10013] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.FOREGROUND;;;?lt=gvf6m3lo 2011-11-25 13:42:59.427 TestApp3[73923:10013] spring (1.0.3.1)> http status code: 200 - no error 2011-11-25 13:43:04.554 TestApp3[73923:11f0b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m7l5
, multiple selections available,
Related content
Mobile App Sensor Documentation (English Version)
Mobile App Sensor Documentation (English Version)
Read with this
Implementation of Stream Measurement
Implementation of Stream Measurement
Read with this
Implementation Android
Implementation Android
Read with this
Tutorial on how to import KMA measurement Objective-C library into Swift project
Tutorial on how to import KMA measurement Objective-C library into Swift project
Read with this
Internet Audience Measurement
Internet Audience Measurement
Read with this
iOS PanelApp development
iOS PanelApp development
Read with this