States

A state is any part of your app a user can be in. For example, some states can include being in a particular level, watching a video, or browsing an in-app store. All states have a time and a duration. The duration is set automatically -- when one state begins, the previous one ends.

Advancing to a state.

This example is called when the user advances to the next level.

[Leanplum advanceTo:@"Level" withInfo:level.name];
Leanplum.advanceTo("Level", withInfo:level.name)

Pausing and resuming.

You can use this if your game has a "pause" mode. You shouldn't call it when someone switches out of your app because that's done automatically.

[Leanplum pauseState];
[Leanplum resumeState];
Leanplum.pauseState()
Leanplum.resumeState()

The 'nil' state.

Causes the user to leave the current state and not enter another one.

[Leanplum advanceTo:nil];
Leanplum.advance(to:nil)

Automatically track states for each view controller.

This currently requires the UIEditor module.

// This code should appear before you display any view controllers in your app.
[Leanplum trackAllAppScreens];
// This code should appear before you display any view controllers in your app.
Leanplum.trackAllAppScreens()