iOS installion

1. Download SDK

Add these files to your project under Xcode: Countly.h Countly.m Countly_OpenUDID.h Countly_OpenUDID.m

2. Following

  • In the project navigator, select your project
  • Select your target
  • Select the Build Phases tab
  • Open Link Binaries With Libraries expander
  • Click the + button
  • Select CoreTelephony.framework, select Optional (instead of Required)
  • (optional) Drag and drop the added framework to the Frameworks group
  • In your application delegate, import Countly.h and inside application:didFinishLaunchingWithOptions:
    add the line;
    [[Countly sharedInstance] start:@"YOUR_APP_KEY" withHost:@"http://cloud.mobilethai.net"]; 
    at the beginning of the function.
It should finally look like this:
#import "Countly.h"  // newly added line
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[Countly sharedInstance] start:@"API_KEY" withHost:@"http://cloud.mobilethai.net"]; // newly added line
// your code
}
  • Select your project
  • Select the Build Phases tab
  • Open Compile Sources tab
  • Double click Countly.m and Countly_OpenUDID.m and add -fno-objc-arc flag

Event Tracking

Create EVENT_KEY menu >> Management>events

Normal event example :

[[Countly sharedInstance] recordEvent:@"EVENT_KEY" count:1];

Event segment example :

NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: @"sports", @"page_count", @"videos", @"page_count"];
[[Countly sharedInstance] recordEvent:@"EVENT_KEY" segmentation:dict count:1];