Batch

@interface Batch

Batch’s main entry point.

  • Use the deeplink delegate object to process deeplink open requests from Batch.

    Setting a delegate will disable Batch’s default behaviour, which is to call [[UIApplication sharedApplication] openURL:]. This works for notifications and mobile landings/in-app messages, as opposed to disabling automatic deeplink handling. It is weakly retained: make sure you retain your delegate in some place, like your application delegate.

    Declaration

    Objective-C

    @property (class, nonatomic, weak, nullable) id<BatchDeeplinkDelegate> deeplinkDelegate;
  • Control whether Batch should enables the FindMyInstallation feature (default = YES) If enabled Batch will copy the current installation id in the clipboard when the application is foregrounded 5 times within 12 seconds.

    Declaration

    Objective-C

    @property (class) int enablesFindMyInstallation;
  • Warning

    Never call this method: Batch only uses static methods.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Start Batch. You should call this method in application:didFinishLaunchingWithOptions: of your UIApplicationDelegate

    Note: This is the method that triggers the hooking or your Application to automatically handle some lifecycle events. If you run into issues, you can try moving this method before other SDK initializations, or call [BatchPush disableAutomaticIntegration] before this method, and follow the “Manual Integration” advanced documentation.

    Declaration

    Objective-C

    + (void)startWithAPIKey:(id)key;

    Parameters

    key

    Your APP’s API Key, LIVE or DEV. You can find it on your dashboard.

  • Handles a URL, if applicable. Call this method in application:openURL:sourceApplication:annotation: of your UIApplicationDelegate

    Declaration

    Objective-C

    + (id)handleURL:(id)url;

    Parameters

    url

    The URL given to you by iOS

    Return Value

    YES if Batch performed an action with this URL, NO otherwise.

  • Check if Batch is running in development mode.

    Declaration

    Objective-C

    + (id)isRunningInDevelopmentMode;

    Return Value

    YES if Batch is started AND if it uses a development API key.

  • Deprecated

    Please use Batch User instead

    Access the default user profile object.

    Declaration

    Objective-C

    + (BatchUserProfile *_Nullable)defaultUserProfile;

    Return Value

    An instance of BatchUserProfile, or nil

  • Control whether Batch should try to use the IDFA or if you forbid it to. (default = YES)

    Warning

    If you disable this, you might not be able to use IDFA based debugging in your dashboard.

    Declaration

    Objective-C

    + (void)setUseIDFA:(id)use;

    Parameters

    use

    YES if Batch can try to use the IDFA, NO if you don’t want Batch to use the IDFA.

  • Set if Batch can use advanced device identifiers (default = YES)

    Advanced device identifiers include information about the device itself, but nothing that directly identify the user, such as but not limited to:

    • Device model

    • Device brand

    • Carrier name

    Setting this to false have a negative impact on core Batch features You should only use it if you know what you are doing.

    Warning

    Disabling this does not automatically disable IDFA collection, please use the appropriate methods to control this.

    Declaration

    Objective-C

    + (void)setUseAdvancedDeviceInformation:(id)use;

    Parameters

    use

    YES if Batch can try to use advanced device information, NO if you don’t

  • Set if Batch should send its logs to a custom object of yours. Be careful with your implementation: setting this can impact stability and performance

    Warning

    You should only use it if you know what you are doing.

    Declaration

    Objective-C

    + (void)setLoggerDelegate:(id<BatchLoggerDelegate> _Nullable)loggerDelegate;

    Parameters

    loggerDelegate

    An object implementing BatchLoggerDelegate. Weakly retained.

  • Get the debug view controller. For development purposes only, this contains UI with multiple debug features allowing you to debug your Batch implementation more easily. If you want to make it accessible in production, you should hide it in a hard to reproduce sequence.

    Should be presented modally.

    Declaration

    Objective-C

    + (id)debugViewController;
  • Toogle whether internal logs should be logged or not.

    If you have a BatchLoggerDelegate, please be careful: the internal logs are quite verbose. Your logger delegate method might be called often, make sure it is performent enough and has a memory allocation limit.

    This can also be controlled using -BatchSDKEnableInternalLogs

    Declaration

    Objective-C

    + (void)setInternalLogsEnabled:(id)enableInternalLogs;

    Parameters

    enableInternalLogs

    Whether to enable development logs. Default: false (unless enabled via CLI)

  • Opt-out from Batch SDK usage. A push opt-out command will be sent to Batch’s servers if the user is connected to the internet. If disconnected, notifications might not be disabled properly. Please use [Batch optOutWithCompletionHandler:] to handle these cases more gracefully.

    Your app should be prepared to handle these cases. Some modules might behave unexpectedly when the SDK is opted out from.

    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.

    If you also want to delete user data, please see [Batch optOutAndWipeData].

    Calling this method when Batch hasn’t started does nothing: Please call [Batch startWithAPIKey:] beforehand.

    Declaration

    Objective-C

    + (void)optOut;
  • Opt-out from Batch SDK and wipe data. An installation data wipe command will be sent to Batch’s servers if the user is connected to the internet. If disconnected, notifications might not be disabled properly. Please use [Batch optOutAndWipeDataWithCompletionHandler:] to handle these cases more gracefully.

    See [Batch optOut] documentation for details Note that once opted out, [Batch startWithAPIKey:] will essentially be a no-op Your app should be prepared to handle these cases.

    Calling this method when Batch hasn’t started does nothing: Please call [Batch startWithAPIKey:] beforehand.

    Declaration

    Objective-C

    + (void)optOutAndWipeData;
  • Opt-out from Batch SDK.

    See [Batch optOut] documentation for details.

    Use the completion handler to be informed about whether the opt-out request has been successfully sent to the server or not. You’ll also be able to control what to do in case of failure.

    Note: if the SDK has already been opted-out from, this method will instantly call the completion handler with a failure state.

    Calling this method when Batch hasn’t started does nothing: Please call [Batch startWithAPIKey:] beforehand.

    Declaration

    Objective-C

    + (void)optOutWithCompletionHandler:(id)handler;
  • Opt-out from Batch SDK and wipe data.

    See [Batch optOutAndWipeData] documentation for details.

    Use the completion handler to be informed about whether the opt-out request has been successfully sent to the server or not. You’ll also be able to control what to do in case of failure.

    Note: if the SDK has already been opted-out from, this method will instantly call the completion handler with a failure state.

    Calling this method when Batch hasn’t started does nothing: Please call [Batch startWithAPIKey:] beforehand.

    Declaration

    Objective-C

    + (void)optOutAndWipeDataWithCompletionHandler:(id)handler;
  • Opt-in to Batch SDK.

    Useful if you called [Batch optOut], [Batch optOutAndWipeData] or opted out by default in your Info.plist You will need to call [Batch startWithAPIKey:@“”] after this.

    Declaration

    Objective-C

    + (void)optIn;
  • Returns whether Batch has been opted out from or not

    Declaration

    Objective-C

    + (id)isOptedOut;
  • If your app handle universal links, set your list of associated domains.

    If your site uses multiple subdomains (such as example.com, www.example.com, or support.example.com), each requires its own entry like in the Associated Domains Entitlement,

    Make sure to only include the desired subdomain and the top-level domain. Don’t include path and query components or a trailing slash (/)

    Declaration

    Objective-C

    + (void)setAssociatedDomains:(id)domains;

    Parameters

    domains

    An array of your supported associated domains.