Leveraging the App47 SDK on iOS is trivial. With a few lines of code, you’ll be able to capture myriad mobile metrics including how often an app is being used, where it’s being used, and importantly, if that app crashes (which it eventually will!), why and what was going on at the time.
You’ll have to download the SDK and integrate it into XCode, just like you would for any other 3rd party library. Once you’ve done that, there are two important steps:
- Add the App’s App47 ID to the
EmbeddedAgentSettings.plist
file. This is how App47 ties metrics to a particular app running in the field. The ID can be obtained via your dashboard — it’s a cryptic looking string of 20 or so characters that uniquely identifies an App within our system. - In the
AppDelegate
‘sdidFinishLaunchingWithOptions
method, add one line of code:
[c language=”++”]
– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[EmbeddedAgent configureAgent];
//….
}
[/c]
That’s it — fire up the App and start using it in a simulator or deploy it as you normally would. Session data will start arriving shortly thereafter.
If you want to capture logging information, such as crashes, you need to do two more things:
-
- Add an exception handler in the
AppDelegate
:
- Add an exception handler in the
[c language=”++”]
void handleUncaughtException(NSException *exception)
{
EALogCrashException(exception, @”Application crashed”);
}
[/c]
-
- Register the handler before you configure the App47 Agent.
[c language=”++”]
– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSSetUncaughtExceptionHandler(&handleUncaughtException);
[EmbeddedAgent configureAgent];
//….
}
[/c]
Of course, the SDK offers additional features out of the box (such as runtime configurations, timed and generic events, etc); however, the steps above give you Session data as well as crash logs.