Cocos Analytics iOS SDK Access Documentation
SDK Download
Import the SDK
Download and decompress the SDK to get the following files:
Copy the contents to the target project:
Add reference library:
SDK Initialization
...
#import "include/cocos-analytics/CAAgent.h"
...
[CAAgent init:@"app_123456" // game ID
storeID:@"app store" // app store
engine:@"cocos" // game engine default "Cocos"
];
Call the initialization interface at didFinishLaunchingWithOptions
in AppDelegate.
Call OnPause
and onResume
when switching between the front and back of the game, and call onDestroy
when the game ends:
- (void)applicationDidEnterBackground:(UIApplication *)application {
[CAAgent onPause];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
[CAAgent onResume];
}
- (void)applicationWillTerminate:(UIApplication *)application {
[CAAgent onDestroy];
}
Local Debugging
SDK also provides CAAgent::enableDebug(boolean)
to enable/disable local log output. After successful debugging, set to False or remove this method.