Integrate your Unity iOS app with Localytics.
Once data is uploaded, it can't be deleted, so it's a good idea to create a test app
in Localytics and use it to perfect
your instrumentation. Then you can switch the app key to the production app.
-
In your Localytics
Dashboard, create a new
application and copy the application key.
-
Download the latest
version of the SDK.
-
Import the unitypackage into your project.
-
Locate Assets/Plugins/iOS/libLocalytics.a and enable AdSupport framework under
Import Settings.
-
Locate Assets/Plugins/iOS/LocalyticsAppController.mm and insert your app key
into the integrate call.
If your app already has an AppController defined, you can merge this
class.
[Localytics integrate:@"App Key"];
-
In any MonoBehaviour, you can now call the Localytics command using the
static Localytics class.
You must use preprocessor directives, as the scripts cannot be called from
the editor. Localytics will
automatically initiate when your app loads and you can call it at any
time.
#if !UNITY_EDITOR && UNITY_IOS
Localytics.LoggingEnabled = true;
Localytics.SessionTimeoutInterval = 15;
#endif
-
Build your app, and add libsqlite3.dylib and libz.dylib to your project. This
cannot be done from the Unity side.
-
Test your app. Run your application in the simulator, or on a real device if
possible, and check your Localytics
Dashboard to see the data
being reported. Remember that the upload is only guaranteed when the session is
opened and closed, so any events you tag may not appear until your second
session.
Congratulations! You're integrated. Check out the data in your
Dashboard or get even more insights
when you start
tagging
events. Don't forget to test your app. Run it in an emulator, or on a real
device if possible.