iOS > Advanced

Opt-out (ex: GDPR)

Starting with Batch 1.12, you can now opt-out from the SDK.

If you plan to send personal user data and have to comply with EU's GDPR, any other data privacy law or simply want to give your users more control regarding their privacy, these methods will help you plug your consent screen to Batch.

There are two SDK operation modes:

  • SDK Enabled by default, opting-out required via an explicit method call: this is the default mode
  • SDK Disabled by default, optin-in required

Opting-out

In order to opt-out from SDK, simply call:

[Batch optOut];
Batch.optOut()

Opting out will:

  • Prevent [Batch startWithAPIKey:] from starting the SDK
  • Disable any network capability from the SDK
  • Disable all In-App campaigns
  • Make the Inbox module return an error immediatly
  • Make any call to -[BatchUserDataEditor save] do nothing
  • Make any "track" methods from BatchUser ineffective

    Even if you opt-in afterwards, data generated (such as user data or tracked events) while opted out WILL be lost.

You can also wipe the local SDK data:

[Batch optOutAndWipeData];
Batch.optOutAndWipeData()

Remote data will not be wiped. To do so, please make a separate deletion request.

Disabling the SDK by default

In order to disable the SDK by default, you need to add a key called BATCH_OPTED_OUT_BY_DEFAULT with a true boolean value to your Info.plist.

Opting-in

Once you've opted-out (either programatically, or by default), you can re-enable the SDK by calling the following:

[Batch optIn];
[Batch startWithAPIKey:@"YOUR_API_KEY"];
Batch.optIn()
Batch.start(withAPIKey: "YOUR_API_KEY")

Note: Even if you've already done so before opting-out, you are required to call [Batch startWithAPIKey:] or the SDK won't work until the next start.