MarketingCloudSDK Class Reference

Inherits from NSObject
Declared in MarketingCloudSDK+Base.h

Overview

The MarketingCloudSDK base class and categories

Other Methods

+ sharedInstance

Returns (or initializes) the shared MarketingCloudSDK instance.

+ (instancetype)sharedInstance

Return Value

The singleton instance of the MarketingCloudSDK.

Discussion

Returns (or initializes) the shared MarketingCloudSDK instance.

Declared In

MarketingCloudSDK+Base.h

– sfmc_configure:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

- (BOOL)sfmc_configure:(NSError *_Nullable *)error

Parameters

error

NSError object describing the error.

Return Value

Returns YES if the configuration is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error. The configuration is synchronously performed and will block the calling thread.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

Declared In

MarketingCloudSDK+Base.h

– sfmc_configureWithDictionary:error:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass in the NSDictionary created by the MarketingCloudSDKConfigBuilder sfmc_build method. Use the MarketingCloudSDKConfigBuilder class to specify the configuration parameter settings needed by your project. Settings that are absent will default to NO. The following example shows how you can use the MarketingCloudSDKConfigBuilder class to create the configuration dictionary.

- (BOOL)sfmc_configureWithDictionary:(NSDictionary *)configuration error:(NSError *_Nullable *)error

Parameters

configuration

NSDictionary created by the MarketingCloudSDKConfigBuilder class

error

NSError object describing the error.

Return Value

Returns YES if the configuration is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error. The configuration is synchronously performed and will block the calling thread.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass in the NSDictionary created by the MarketingCloudSDKConfigBuilder sfmc_build method. Use the MarketingCloudSDKConfigBuilder class to specify the configuration parameter settings needed by your project. Settings that are absent will default to NO. The following example shows how you can use the MarketingCloudSDKConfigBuilder class to create the configuration dictionary.

 MarketingCloudSDKConfigBuilder *mcsdkBuilder = [MarketingCloudSDKConfigBuilder new];
 [mcsdkBuilder sfmc_setApplicationId:@"93783629-08C7-48D3-8482-3E5BC8DBA888"];
 [mcsdkBuilder sfmc_setAccessToken:@"xyzymn5gb7y2z3wph3t4yxyz"];
 [mcsdkBuilder sfmc_setInboxEnabled:@(YES)];
 [mcsdkBuilder sfmc_setLocationEnabled:@(YES)];
 [mcsdkBuilder sfmc_setAnalyticsEnabled:@(YES)];
 [mcsdkBuilder sfmc_setPiAnalyticsEnabled:@(YES)];
 [mcsdkBuilder sfmc_setMid:@"1234567"];
 [mcsdkBuilder sfmc_setMarketingCloudServerUrl:@"https://consumer.exacttargetapis.com"];

 NSError *error = nil;
 BOOL success = [[MarketingCloudSDK sharedInstance] sfmc_configureWithDictionary:[mcsdkBuilder sfmc_build] error:&error];

Declared In

MarketingCloudSDK+Base.h

– sfmc_configureWithDictionary:error:completionHandler:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass in the NSDictionary created by the MarketingCloudSDKConfigBuilder sfmc_build method. Use the MarketingCloudSDKConfigBuilder class to specify the configuration parameter settings needed by your project. Settings that are absent will default to NO. The following example shows how you can use the MarketingCloudSDKConfigBuilder class to create the configuration dictionary.

- (BOOL)sfmc_configureWithDictionary:(NSDictionary *)configuration error:(NSError *_Nullable *)error completionHandler:(void ( ^ _Nullable ) ( BOOL configured , NSString *appId , NSError *completionError ))completionHandler

Parameters

configuration

NSDictionary created by the MarketingCloudSDKConfigBuilder class

error

NSError object describing the error.

completionHandler

Called when the asynchronous portion has completed. Do not proceed if NO is returned and error will contain an error object describing the error. If completionHandler is nil, the configuration is synchronously performed and will block the calling thread.

Return Value

Returns YES if the configuration is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error. The configuration is synchronously performed and will block the calling thread.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass in the NSDictionary created by the MarketingCloudSDKConfigBuilder sfmc_build method. Use the MarketingCloudSDKConfigBuilder class to specify the configuration parameter settings needed by your project. Settings that are absent will default to NO. The following example shows how you can use the MarketingCloudSDKConfigBuilder class to create the configuration dictionary.

MarketingCloudSDKConfigBuilder *mcsdkBuilder = [MarketingCloudSDKConfigBuilder new];
[mcsdkBuilder sfmc_setApplicationId:@"93783629-08C7-48D3-8482-3E5BC8DBA888"];
[mcsdkBuilder sfmc_setAccessToken:@"xyzymn5gb7y2z3wph3t4yxyz"];
[mcsdkBuilder sfmc_setInboxEnabled:@(YES)];
[mcsdkBuilder sfmc_setLocationEnabled:@(YES)];
[mcsdkBuilder sfmc_setAnalyticsEnabled:@(YES)];
[mcsdkBuilder sfmc_setPiAnalyticsEnabled:@(YES)];
[mcsdkBuilder sfmc_setMid:@"1234567"];
[mcsdkBuilder sfmc_setMarketingCloudServerUrl:@"https://consumer.exacttargetapis.com"];

NSError *error = nil;
BOOL success = [[MarketingCloudSDK sharedInstance] sfmc_configureWithDictionary:[mcsdkBuilder sfmc_build] error:&error completionHandler:^(BOOL success, NSString *appid, NSError *error) {}];

Declared In

MarketingCloudSDK+Base.h

– sfmc_configureWithURL:configurationIndex:error:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

- (BOOL)sfmc_configureWithURL:(NSURL *_Nullable)url configurationIndex:(NSNumber *)configurationIndex error:(NSError *_Nullable *)error

Parameters

url

URL to a JSON configuration file that is embedded in the application bundle.

configurationIndex

zero based index into into the JSON file array of configuration settings.

error

NSError object describing the error.

Return Value

Returns YES if the configuration is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error. The configuration is synchronously performed and will block the calling thread.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

Declared In

MarketingCloudSDK+Base.h

– sfmc_configure:completionHandler:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

- (BOOL)sfmc_configure:(NSError *_Nullable *)error completionHandler:(void ( ^ _Nullable ) ( BOOL configured , NSString *appId , NSError *_Nullable error ))completionHandler

Parameters

error

NSError object describing the error.

completionHandler

Called when the asynchronous portion of the configuration has completed. Do not proceed if NO is returned and error will contain an error object describing the error. If completionHandler is nil, the configuration is synchronously performed and will block the calling thread.

Return Value

Returns YES if the synchronous portion is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must have a JSON file embedded in the application bundle with optional parameter settings as part of your project. Settings that are absent will default to NO. See documentation for example JSON.

Declared In

MarketingCloudSDK+Base.h

– sfmc_configureWithURL:configurationIndex:error:completionHandler:

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass a URL to a JSON file with optional parameter settings. Settings that are absent will default to NO. See documentation for example JSON.

- (BOOL)sfmc_configureWithURL:(NSURL *)url configurationIndex:(NSNumber *)configurationIndex error:(NSError *_Nullable *)error completionHandler:(void ( ^ _Nullable ) ( BOOL configured , NSString *appId , NSError *_Nullable error ))completionHandler

Parameters

url

URL to a JSON configuration file that is embedded in the application bundle.

configurationIndex

zero based index into into the JSON file array of configuration settings.

error

NSError object describing the error.

completionHandler

Called when the asynchronous portion has completed. Do not proceed if NO is returned and error will contain an error object describing the error. If completionHandler is nil, the configuration is synchronously performed and will block the calling thread.

Return Value

Returns YES if the synchronous portion is successful or NO if failed. Do not proceed if NO is returned and error will contain an error object describing the error.

Discussion

This is the main configuration method, responsible for setting credentials needed to communicate with Salesforce. You must pass a URL to a JSON file with optional parameter settings. Settings that are absent will default to NO. See documentation for example JSON.

Declared In

MarketingCloudSDK+Base.h

– sfmc_tearDown

this method properly closes down the MarketingCloudSDK. It should be used in any cases where references to the MarketingCloudSDK need to be released.

- (void)sfmc_tearDown

Discussion

this method properly closes down the MarketingCloudSDK. It should be used in any cases where references to the MarketingCloudSDK need to be released.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setContactKey:

Accepts and sets the Contact Key for the device’s user. Formerly know in the SDK as “subscriberKey”.

- (BOOL)sfmc_setContactKey:(NSString *_Nonnull)contactKey

Parameters

contactKey

The contact key to attribute to the user.

Return Value

YES if set successfully.

Discussion

Accepts and sets the Contact Key for the device’s user. Formerly know in the SDK as “subscriberKey”.

Cannot be nil or blank.

Will trim leading and trailing whitespace.

Declared In

MarketingCloudSDK+Base.h

– sfmc_contactKey

Returns the contact key for the active user, in case you need it.

- (NSString *_Nullable)sfmc_contactKey

Return Value

contactKey The code-set contact key.

Discussion

Returns the contact key for the active user, in case you need it.

Declared In

MarketingCloudSDK+Base.h

– sfmc_addTag:

Adds the provided Tag (NSString) to the set of unique tags.

- (BOOL)sfmc_addTag:(NSString *_Nonnull)tag

Parameters

tag

A string to add to the list of tags.

Return Value

YES if added successfully.

Discussion

Adds the provided Tag (NSString) to the set of unique tags.

Will trim leading and trailing whitespace.

Cannot be nil or blank.

Declared In

MarketingCloudSDK+Base.h

– sfmc_removeTag:

Removes the provided Tag (NSString) from the list of tags.

- (BOOL)sfmc_removeTag:(NSString *_Nonnull)tag

Parameters

tag

A string to remove from the list of tags.

Return Value

tag Echoes the tag back on successful removal, or nil if something failed.

Discussion

Removes the provided Tag (NSString) from the list of tags.

Declared In

MarketingCloudSDK+Base.h

– sfmc_addTags:

Adds the provided array of Tags (NSString) to the set of unique tags.

- (NSSet *_Nullable)sfmc_addTags:(NSArray *_Nonnull)tags

Parameters

tags

An array of tags to add to the list.

Return Value

Set of tags added, as strings, or nil if something failed.

Discussion

Adds the provided array of Tags (NSString) to the set of unique tags.

Will trim leading and trailing whitespace.

Cannot be nil or blank.

Declared In

MarketingCloudSDK+Base.h

– sfmc_removeTags:

Removes the provided array of Tags (NSString) from the list of tags.

- (NSSet *_Nullable)sfmc_removeTags:(NSArray *_Nonnull)tags

Parameters

tags

An array of tags to removed from the list.

Return Value

Set of tags removed upon success, as strings, or nil if something failed.

Discussion

Removes the provided array of Tags (NSString) from the list of tags.

Declared In

MarketingCloudSDK+Base.h

– sfmc_tags

Returns the list of tags for this device.

- (NSSet *_Nullable)sfmc_tags

Return Value

All tags associated, as strings.

Discussion

Returns the list of tags for this device.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setAttributeNamed:value:

Set an attribute to the data set sent to Salesforce.

- (BOOL)sfmc_setAttributeNamed:(NSString *_Nonnull)name value:(NSString *_Nonnull)value

Parameters

name

The name of the attribute you wish to send. This will be the key of the pair.

value

The value to set for the data pair.

Return Value

YES if set successfully.

Discussion

Set an attribute to the data set sent to Salesforce.

The Attribute Name cannot be nil or blank, or one of the reserved words.

Will trim leading and trailing whitespace from the name and value.

The attribute must be defined within the SFMC Contact model prior to setting a value. If the attribute does not exist within the SFMC Contact model, then this attribute will be accepted by the SDK, but will be ignored within the SFMC.

If you previously set a value for the named attribute, then the value will be updated with the new value and sent to the SFMC.

If you send in a blank value, then the value will be sent to the SFMC to remove that value from the Contact record.

All attribute values set with this method persist through the installation of the app on your customer device.

Note that attribute mapping is case sensitive, and spaces should be avoided when setting up new attributes in the SFMC Contact model.

Declared In

MarketingCloudSDK+Base.h

– sfmc_clearAttributeNamed:

Removes the named attribute from the data set to send to Salesforce. The value is not changed on the SFMC.

- (BOOL)sfmc_clearAttributeNamed:(NSString *_Nonnull)name

Parameters

name

The name of the attribute you wish to remove.

Return Value

Returns the value that was set. It will no longer be sent back to Salesforce.

Discussion

Removes the named attribute from the data set to send to Salesforce. The value is not changed on the SFMC.

Declared In

MarketingCloudSDK+Base.h

– sfmc_attributes

Returns a read-only copy of the Attributes dictionary as it is right now.

- (NSDictionary *_Nullable)sfmc_attributes

Return Value

All attributes currently set.

Discussion

Returns a read-only copy of the Attributes dictionary as it is right now.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setAttributes:

Set multiple attributes (key/value dictionaries) to Salesforce. See comments in -sfmc_setAttributeNamed.

- (NSDictionary *_Nullable)sfmc_setAttributes:(NSArray *_Nonnull)attributes

Parameters

attributes

An array of dictionaries of key (attribute name) and value (attribute value).

Return Value

A set of all attributes set.

Discussion

Set multiple attributes (key/value dictionaries) to Salesforce. See comments in -sfmc_setAttributeNamed.

Declared In

MarketingCloudSDK+Base.h

– sfmc_clearAttributesNamed:

Remove multiple attributes from Salesforce. See comments in -sfmc_setAttributeNamed.

- (NSDictionary *_Nullable)sfmc_clearAttributesNamed:(NSArray *_Nonnull)attributeNames

Parameters

attributeNames

An array of attribute names.

Return Value

A set of all attributes removed.

Discussion

Remove multiple attributes from Salesforce. See comments in -sfmc_setAttributeNamed.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setDeviceToken:

Responsible for sending the Apple device token back to Salesforce. It marks the end of the token registration flow. If it is unable to reach Salesforce server, it will save the token and try again later.

- (void)sfmc_setDeviceToken:(NSData *_Nonnull)deviceToken

Parameters

deviceToken

Token as received from Apple.

Discussion

Responsible for sending the Apple device token back to Salesforce. It marks the end of the token registration flow. If it is unable to reach Salesforce server, it will save the token and try again later.

This method is necessary to the implementation of Salesforce Push.

Declared In

MarketingCloudSDK+Base.h

– sfmc_deviceToken

Returns the device token as a NSString.

- (NSString *_Nullable)sfmc_deviceToken

Return Value

NSData A stringified version of the Apple deviceToken.

Discussion

Returns the device token as a NSString.

Declared In

MarketingCloudSDK+Base.h

– sfmc_appID

Returns the Salesforce application ID.

- (NSString *_Nullable)sfmc_appID

Return Value

NSString Salesforce application ID.

Discussion

Returns the Salesforce application ID.

Declared In

MarketingCloudSDK+Base.h

– sfmc_accessToken

Returns the Salesforce application accessToken.

- (NSString *_Nullable)sfmc_accessToken

Return Value

NSString Salesforce application accessToken.

Discussion

Returns the Salesforce application accessToken.

Declared In

MarketingCloudSDK+Base.h

– sfmc_deviceIdentifier

Returns the unique device identifier that Salesforce will use to identify the device.

- (NSString *_Nullable)sfmc_deviceIdentifier

Return Value

NSString The device identifier (a UUID) as a NSString.

Discussion

Returns the unique device identifier that Salesforce will use to identify the device.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setNotificationRequest:

Informs the SDK of the current notification.

- (void)sfmc_setNotificationRequest:(UNNotificationRequest *)request

Parameters

request

The UNNotificationRequest that generated a notification.

Discussion

Informs the SDK of the current notification.

Declared In

MarketingCloudSDK+Base.h

– sfmc_notificationRequest

Returns the last notification delivered to the SDK.

- (UNNotificationRequest *)sfmc_notificationRequest

Return Value

UNNotificationRequest * The last UNNotificationRequest that generated a notification.

Discussion

Returns the last notification delivered to the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setNotificationUserInfo:

Informs the SDK of the current notification.

- (void)sfmc_setNotificationUserInfo:(NSDictionary *)userInfo

Parameters

userInfo

The user info the last notification delivered to the SDK.

Discussion

Informs the SDK of the current notification.

Declared In

MarketingCloudSDK+Base.h

– sfmc_notificationUserInfo

Returns the user info of the last notification delivered to the SDK.

- (NSDictionary *)sfmc_notificationUserInfo

Return Value

NSDictionary * The user info the last notification delivered to the SDK.

Discussion

Returns the user info of the last notification delivered to the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setPushEnabled:

Developer override to set the state of push enablement to YES/NO. If set to NO, the application will not receive any push notifications once the Marketing Cloud server has been updated. When this value is NO, it takes precedence (overrides) the user notifications settings (i.e., setting this to NO will always disable push.) Conversely, if the user has notifications settings disabled, the developer cannot enable push via this method. A NO value from either source (user settings or developer interface) always wins. Allows setting the state of pushEnabled to YES/NO. If set to NO, the application will not receive any push notifications. When this value is NO, it takes precedence over the user notifications settings (i.e., setting this to NO will always disable push.) If the user has notifications settings disabled that will override this setting and push will be disabled.

- (void)sfmc_setPushEnabled:(BOOL)pushEnabled

Parameters

pushEnabled

Set to YES to enable push notifications.

Discussion

Developer override to set the state of push enablement to YES/NO. If set to NO, the application will not receive any push notifications once the Marketing Cloud server has been updated. When this value is NO, it takes precedence (overrides) the user notifications settings (i.e., setting this to NO will always disable push.) Conversely, if the user has notifications settings disabled, the developer cannot enable push via this method. A NO value from either source (user settings or developer interface) always wins. Allows setting the state of pushEnabled to YES/NO. If set to NO, the application will not receive any push notifications. When this value is NO, it takes precedence over the user notifications settings (i.e., setting this to NO will always disable push.) If the user has notifications settings disabled that will override this setting and push will be disabled.

Declared In

MarketingCloudSDK+Base.h

– sfmc_pushEnabled

The current state of the developer’s push enablement override The current state of the pushEnabled flag in the SDK.

- (BOOL)sfmc_pushEnabled

Return Value

returns a BOOL value of the developer’s push enablement override.

returns a BOOL value of the current pushEnabled state.

Discussion

The current state of the developer’s push enablement override The current state of the pushEnabled flag in the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_getSDKState

Outputs a formatted, easily readable block of text describing the current status of the SDK.

- (nullable NSString *)sfmc_getSDKState

Return Value

JSON string with values of the current state of the SDK.

Discussion

Outputs a formatted, easily readable block of text describing the current status of the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setDebugLoggingEnabled:

Enable/Disable extra debug logging from the SDK.

- (void)sfmc_setDebugLoggingEnabled:(BOOL)enabled

Parameters

enabled

BOOL for enabling or disabling extra SDK logging.

Discussion

Enable/Disable extra debug logging from the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_getDebugLoggingEnabled

The current state of the debug logging flag in the SDK.

- (BOOL)sfmc_getDebugLoggingEnabled

Return Value

returns a BOOL value of the current debug logging state.

Discussion

The current state of the debug logging flag in the SDK.

Declared In

MarketingCloudSDK+Base.h

– sfmc_refreshWithFetchCompletionHandler:

Ask MarketingCloudSDK to update its data. MarketingCloudSDK will throttle attempts based on the time since the last time this was called.

- (BOOL)sfmc_refreshWithFetchCompletionHandler:(void ( ^ _Nullable ) ( UIBackgroundFetchResult result ))completionHandler

Parameters

completionHandler

The UIBackgroundFetchResult completion handler. This method will be called with UIBackgroundFetchResultNoData if no attempt was made to update data, otherwise it will be called with UIBackgroundFetchResultNewData after the update completes. If nil is passed, then process of the completion handler must be managed by the caller.

Return Value

YES if MarketingCloudSDK did make an attempt at updating data.

Discussion

Ask MarketingCloudSDK to update its data. MarketingCloudSDK will throttle attempts based on the time since the last time this was called.

Declared In

MarketingCloudSDK+Base.h

– sfmc_setSignedString:

Add a signedString security token for registration security

- (BOOL)sfmc_setSignedString:(NSString *_Nullable)signedString

Parameters

signedString

signedString opaque token used to verify registration. pass nil to clear signedString.

Return Value

YES if signedString was set successfully

Discussion

Add a signedString security token for registration security

Declared In

MarketingCloudSDK+Base.h

– sfmc_signedString

Returns the value of last stored signedString security token

- (NSString *_Nullable)sfmc_signedString

Return Value

a NSString of last stored signedString security token

Discussion

Returns the value of last stored signedString security token

Declared In

MarketingCloudSDK+Base.h

– sfmc_isReady

BOOL indicating whether the SDK is ready to be used.

- (BOOL)sfmc_isReady

Return Value

returns YES if the SDK is initialized and ready to be used.

Discussion

BOOL indicating whether the SDK is ready to be used.

Declared In

MarketingCloudSDK+Base.h

– sfmc_isInitializing

BOOL indicating the SDK is in the process of being initialized.

- (BOOL)sfmc_isInitializing

Return Value

returns YES if the SDK is in the process of being initialized.

Discussion

BOOL indicating the SDK is in the process of being initialized.

Declared In

MarketingCloudSDK+Base.h

Events Methods

– sfmc_setEventDelegate:

Method to set a delegate class (adhering to the MarketingCloudSDKEventDelegate protocol) to implment methods for In-App Message lifecycle events.

- (void)sfmc_setEventDelegate:(id<MarketingCloudSDKEventDelegate> _Nullable)delegate

Parameters

delegate

the class implementing the MarketingCloudSDKEventDelegate.

Discussion

Method to set a delegate class (adhering to the MarketingCloudSDKEventDelegate protocol) to implment methods for In-App Message lifecycle events.

Declared In

MarketingCloudSDK+Events.h

– sfmc_messageIdForMessage:

Extract a message identifier for an In-App Message dictionary (provided in the MarketingCloudSDKEventDelegate methods).

- (NSString *_Nullable)sfmc_messageIdForMessage:(NSDictionary *_Nonnull)message

Parameters

message

NSDictionary representing an In-App Message

Return Value

string value of the message identifier

Discussion

Extract a message identifier for an In-App Message dictionary (provided in the MarketingCloudSDKEventDelegate methods).

Declared In

MarketingCloudSDK+Events.h

– sfmc_showInAppMessage:

When called, instructs the SDK to attempt to display the In-App Message. This will cause the MarketingCloudSDKEventDelegate methods to be called, if implemented.

- (void)sfmc_showInAppMessage:(NSString *_Nonnull)messageId

Parameters

messageId

identifier of In-App Message

Discussion

When called, instructs the SDK to attempt to display the In-App Message. This will cause the MarketingCloudSDKEventDelegate methods to be called, if implemented.

Declared In

MarketingCloudSDK+Events.h

– sfmc_setInAppMessageFontName:

When called, sets the font for In-App Message display.

- (BOOL)sfmc_setInAppMessageFontName:(NSString *_Nullable)fontName

Parameters

fontName

name of font installed on device or built into application. Note: this may be different than the font family name. If nil, the SDK default (system font) will be used.

Return Value

value of YES indicating that the font name is valid and can be used, NO if the font name is not valid. If nil is passed as fontName, YES will be returned.

Discussion

When called, sets the font for In-App Message display.

Declared In

MarketingCloudSDK+Events.h

Intelligence Methods

– sfmc_setPiIdentifier:

Set the identifier to associate with Predictive Intelligence data sent to Salesforce Marketing Cloud

- (BOOL)sfmc_setPiIdentifier:(NSString *_Nullable)identifier

Parameters

identifier

The string you want to associate analytics with.

Return Value

YES if set successfully.

Discussion

Set the identifier to associate with Predictive Intelligence data sent to Salesforce Marketing Cloud

The clear the value, pass a nil value.

Will trim leading and trailing whitespace from the string.

An identifier will persist until it is cleared or changed and will used to associate with all analytic events generated while set.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_piIdentifier

Returns a read-only copy of the Analytics identity set

- (NSString *_Nullable)sfmc_piIdentifier

Return Value

All attributes currently set.

Discussion

Returns a read-only copy of the Analytics identity set

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_trackMessageOpened:

When an Inbox message is opened (for instance, you implement an inbox and present the CloudPage URL in your webview) this method should be called with the Inbox message so that the MarketingCloudSDK can track the proper analytics and state of the message.

- (void)sfmc_trackMessageOpened:(NSDictionary *_Nonnull)inboxMessage

Parameters

inboxMessage

a non-nil NSDictionary object representing an Inbox message

Discussion

When an Inbox message is opened (for instance, you implement an inbox and present the CloudPage URL in your webview) this method should be called with the Inbox message so that the MarketingCloudSDK can track the proper analytics and state of the message.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_trackPageViewWithURL:title:item:search:

Track page views within your application.

- (void)sfmc_trackPageViewWithURL:(NSString *_Nonnull)url title:(NSString *_Nullable)title item:(NSString *_Nullable)item search:(NSString *_Nullable)search

Parameters

url

a non-nil NSString to identify the location within your app traversed by your customers. For example: com.yourpackage.viewcontrollername

title

a NSString (nil if n/a) to identify the title of the location within your app traversed by your customers. For example: Screen Name

item

a NSString (nil if n/a) to identify an item viewed by your customer. For example: UPC-1234

search

a NSString (nil if n/a) to identify search terms used by your customer. For example: blue jeans.

Discussion

Track page views within your application.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_trackCartContents:

Track cart contents within your application.

- (void)sfmc_trackCartContents:(NSDictionary *_Nonnull)cartDictionary

Parameters

cartDictionary

a non-nil NSDictionanry object containing a cartID and an array of cart item dictionaries

Discussion

Track cart contents within your application.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_trackCartConversion:

Track cart conversion within your application.

- (void)sfmc_trackCartConversion:(NSDictionary *_Nonnull)orderDictionary

Parameters

orderDictionary

a non-nil NSDictionanry object representing an order; created from a cart and cart items and “converted” into a sale of some sort

Discussion

Track cart conversion within your application.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_cartItemDictionaryWithPrice:quantity:item:uniqueId:

Initialize a Cart Item dictionary for use in analytics.

- (NSDictionary *_Nullable)sfmc_cartItemDictionaryWithPrice:(NSNumber *_Nonnull)price quantity:(NSNumber *_Nonnull)quantity item:(NSString *_Nonnull)item uniqueId:(NSString *_Nullable)uniqueId

Parameters

price

The price amount (USD) of this item (non-nil value; 0 permissable)

quantity

The count of items in the cart for this particular product (non-nil value; greater than zero)

item

The unique product code from the e-commerce system representing this cart item (non-nil string value)

uniqueId

The unique product id. from the e-commerce system representing this cart item (string value; nil permissable)

Return Value

instancetype a NSDictionary representing a cart item.

Discussion

Initialize a Cart Item dictionary for use in analytics.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_cartDictionaryWithCartItemDictionaryArray:

Initialize a Cart dictionary for use in analytics.

- (NSDictionary *_Nullable)sfmc_cartDictionaryWithCartItemDictionaryArray:(NSArray *_Nonnull)cartItemDictionaryArray

Parameters

cartItemDictionaryArray

An array of cart item dictionary objects (non-nil array). An empty array indicates an empty cart, and will be used to indicate a cleared cart to the analytics system.

Return Value

instancetype a MarketingCloudSDKCart.

Discussion

Initialize a Cart dictionary for use in analytics.

Declared In

MarketingCloudSDK+Intelligence.h

– sfmc_orderDictionaryWithOrderNumber:shipping:discount:cart:

Initialize an Order dictionary for use in analytics.

- (NSDictionary *_Nullable)sfmc_orderDictionaryWithOrderNumber:(NSString *_Nonnull)orderNumber shipping:(NSNumber *_Nonnull)shipping discount:(NSNumber *_Nonnull)discount cart:(NSDictionary *_Nonnull)cartDictionary

Parameters

orderNumber

The order number of from the e-commerce system (non-nil string)

shipping

The shipping amount (USD) of this order (non-nil value; 0 permissable)

discount

The discount amount (USD) of this order (non-nil value; 0 permissable)

cartDictionary

The order’s shopping cart object (non-nil object)

Return Value

instancetype a NSDictionary representing an order.

Discussion

Initialize an Order dictionary for use in analytics.

Declared In

MarketingCloudSDK+Intelligence.h

URLHandling Methods

– sfmc_setURLHandlingDelegate:

Method to set a delegate implementing the MarketingCloudSDKURLHandlingDelegate.

- (void)sfmc_setURLHandlingDelegate:(id<MarketingCloudSDKURLHandlingDelegate> _Nullable)delegate

Parameters

delegate

value A class adhering to the MarketingCloudSDKURLHandlingDelegate and implementing the required method.

Discussion

Method to set a delegate implementing the MarketingCloudSDKURLHandlingDelegate.

Declared In

MarketingCloudSDK+URLHandling.h

InboxMessages Methods

– sfmc_getAllMessages

Get all active Inbox messages already downloaded from the MarketingCloud

- (NSArray *_Nullable)sfmc_getAllMessages

Return Value

array of NSDictionaries representing Inbox messages

Discussion

Get all active Inbox messages already downloaded from the MarketingCloud

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getUnreadMessages

Get unread active Inbox messages (already downloaded from the MarketingCloud)

- (NSArray *_Nullable)sfmc_getUnreadMessages

Return Value

array of NSDictionaries representing Inbox messages

Discussion

Get unread active Inbox messages (already downloaded from the MarketingCloud)

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getReadMessages

Get active Inbox messages marked as read (already downloaded from the MarketingCloud)

- (NSArray *_Nullable)sfmc_getReadMessages

Return Value

array of NSDictionaries representing Inbox messages

Discussion

Get active Inbox messages marked as read (already downloaded from the MarketingCloud)

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getDeletedMessages

Get active Inbox messages marked as deleted (already downloaded from the MarketingCloud)

- (NSArray *_Nullable)sfmc_getDeletedMessages

Return Value

array of NSDictionaries representing Inbox messages

Discussion

Get active Inbox messages marked as deleted (already downloaded from the MarketingCloud)

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getAllMessagesCount

Get count of all active Inbox messages already downloaded from the MarketingCloud.

- (NSUInteger)sfmc_getAllMessagesCount

Return Value

number of messages

Discussion

Get count of all active Inbox messages already downloaded from the MarketingCloud.

Useful for inbox count badges or other interface elements, without having to fetch messages directly.

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getUnreadMessagesCount

Get count of unread active Inbox messages (already downloaded from the MarketingCloud)

- (NSUInteger)sfmc_getUnreadMessagesCount

Return Value

number of messages

Discussion

Get count of unread active Inbox messages (already downloaded from the MarketingCloud)

Useful for inbox count badges or other interface elements, without having to fetch messages directly.

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getReadMessagesCount

Get count of active Inbox messages marked as read (already downloaded from the MarketingCloud)

- (NSUInteger)sfmc_getReadMessagesCount

Return Value

number of messages

Discussion

Get count of active Inbox messages marked as read (already downloaded from the MarketingCloud)

Useful for inbox count badges or other interface elements, without having to fetch messages directly.

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_getDeletedMessagesCount

Get count of active Inbox messages marked as deleted (already downloaded from the MarketingCloud)

- (NSUInteger)sfmc_getDeletedMessagesCount

Return Value

number of messages

Discussion

Get count of active Inbox messages marked as deleted (already downloaded from the MarketingCloud)

Useful for inbox count badges or other interface elements, without having to fetch messages directly.

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markMessageRead:

Mark a Inbox message as read.

- (BOOL)sfmc_markMessageRead:(NSDictionary *_Nonnull)messageDictionary

Parameters

messageDictionary

a dictionary representing an Inbox message

Return Value

a value indicatating success in setting the message to read

Discussion

Mark a Inbox message as read.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markMessageDeleted:

Mark an Inbox message as deleted.

- (BOOL)sfmc_markMessageDeleted:(NSDictionary *_Nonnull)messageDictionary

Parameters

messageDictionary

a dictionary representing an Inbox message

Return Value

a value indicatating success in setting the message to deleted

Discussion

Mark an Inbox message as deleted.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markMessageWithIdRead:

Mark a Inbox message as read using messageId.

- (BOOL)sfmc_markMessageWithIdRead:(NSString *_Nonnull)messageId

Parameters

messageId

a string representing an Inbox message identifier

Return Value

a value indicatating success in setting the message to read

Discussion

Mark a Inbox message as read using messageId.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markMessageWithIdDeleted:

Mark an Inbox message as deleted using messageId.

- (BOOL)sfmc_markMessageWithIdDeleted:(NSString *_Nonnull)messageId

Parameters

messageId

a string representing an Inbox message identifier

Return Value

a value indicatating success in setting the message to deleted

Discussion

Mark an Inbox message as deleted using messageId.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markAllMessagesRead

Mark all Inbox messages as read.

- (BOOL)sfmc_markAllMessagesRead

Return Value

a value indicatating success in setting the messages to read

Discussion

Mark all Inbox messages as read.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_markAllMessagesDeleted

Mark all Inbox messages as deleted.

- (BOOL)sfmc_markAllMessagesDeleted

Return Value

a value indicatating success in setting the messages to deleted

Discussion

Mark all Inbox messages as deleted.

Note: this information is persisted locally and would be reset if the SDK’s data is reset (via app delete and reinstall, for instance).

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_refreshMessages

Reload and refresh Inbox messages from the MarketingCloud server.

- (BOOL)sfmc_refreshMessages

Return Value

A BOOL value indicating that refreshing has been started.

Discussion

Reload and refresh Inbox messages from the MarketingCloud server.

Note: The underlying request to the server will be throttled such that it will execute at most every 60 seconds. If the method has been called less than 60s after the preceeding method call, NO will be returned and the request will not be made. If NO is returned, it is suggested that any UI used to reflect the refresh operation is updated (pull to refresh indicators, loading spinners, etc.).

This method will cause notifications to be posted to NSNotificationCenter:

  • SFMCInboxMessagesRefreshCompleteNotification: posted when the refresh process has completed
  • SFMCInboxMessagesNewInboxMessagesNotification: posted if there are new Inbox messages

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_inboxMessagesTableViewDataSourceForTableView:

Create an instance of a basic UITableView data source to handle all loading for a simple view controller showing Inbox messages.

- (MarketingCloudSDKInboxMessagesDataSource *_Nullable)sfmc_inboxMessagesTableViewDataSourceForTableView:(UITableView *_Nonnull)tableView

Parameters

tableView

The UITableView used in the view controller. The data source will “own” population of the data and display of simple cells.

Return Value

An instance of MarketingCloudSDKInboxMessagesDataSource, a class which implements a simple set of methods from the UITableViewDataSource protocol.

Discussion

Create an instance of a basic UITableView data source to handle all loading for a simple view controller showing Inbox messages.

Declared In

MarketingCloudSDK+InboxMessages.h

– sfmc_inboxMessagesTableViewDelegateForTableView:dataSource:

Create an instance of a basic UITableView delegate to handle cell selection for a simple view controller showing Inbox messages.

- (MarketingCloudSDKInboxMessagesDelegate *_Nullable)sfmc_inboxMessagesTableViewDelegateForTableView:(UITableView *_Nonnull)tableView dataSource:(MarketingCloudSDKInboxMessagesDataSource *_Nonnull)dataSource

Parameters

tableView

The UITableView used in the view controller. The delegate will “own” selection of the cells.

dataSource

An instance of MarketingCloudSDKInboxMessagesDataSource, a class which implements a simple set of methods from the UITableViewDataSource protocol.

Return Value

An instance of MarketingCloudSDKInboxMessagesDelegate, a class which implements a simple set of methods from the UITableViewDelegate protocol.

Discussion

Create an instance of a basic UITableView delegate to handle cell selection for a simple view controller showing Inbox messages.

Declared In

MarketingCloudSDK+InboxMessages.h

Location Methods

– sfmc_setLocationDelegate:

Method to set a delegate implementing the MarketingCloudSDKLocationDelegate.

- (void)sfmc_setLocationDelegate:(id<MarketingCloudSDKLocationDelegate> _Nullable)delegate

Parameters

delegate

value A class adhering to the MarketingCloudSDKLocationDelegate and implementing the required method.

Discussion

Method to set a delegate implementing the MarketingCloudSDKLocationDelegate.

Declared In

MarketingCloudSDK+Location.h

– sfmc_regionFromDictionary:

Method to convert a region dictionary returned from sfmc_shouldShowLocationMessage into a CLRegion

- (CLRegion *_Nullable)sfmc_regionFromDictionary:(NSDictionary *_Nonnull)dictionary

Parameters

dictionary

value representing a region object from the sfmc_shouldShowLocationMessage method

Discussion

Method to convert a region dictionary returned from sfmc_shouldShowLocationMessage into a CLRegion

Declared In

MarketingCloudSDK+Location.h

– sfmc_locationEnabled

Determines the state of Location Services based on developer setting and OS-level permission. This is the preferred method for checking for location state.

- (BOOL)sfmc_locationEnabled

Return Value

A boolean value reflecting if location services are enabled (i.e. authorized) or not.

Discussion

Determines the state of Location Services based on developer setting and OS-level permission. This is the preferred method for checking for location state.

Declared In

MarketingCloudSDK+Location.h

– sfmc_startWatchingLocation

Use this method to initiate Location Services through the MobilePush SDK.

- (void)sfmc_startWatchingLocation

Discussion

Use this method to initiate Location Services through the MobilePush SDK.

Declared In

MarketingCloudSDK+Location.h

– sfmc_stopWatchingLocation

Use this method to disable Location Services through the MobilePush SDK.

- (void)sfmc_stopWatchingLocation

Discussion

Use this method to disable Location Services through the MobilePush SDK.

Declared In

MarketingCloudSDK+Location.h

– sfmc_watchingLocation

Use this method to determine if the SDK is actively monitoring location.

- (BOOL)sfmc_watchingLocation

Return Value

A boolean value reflecting if the SDK has called startWatchingLocation.

Discussion

Use this method to determine if the SDK is actively monitoring location.

Declared In

MarketingCloudSDK+Location.h

– sfmc_lastKnownLocation

A dictionary version of the last known Location. The dictionary will contain two keys, latitude and longitude, which are NSNumber wrappers around doubles. Use doubleValue to retrieve.

- (NSDictionary<NSString*,NSString*> *_Nullable)sfmc_lastKnownLocation

Discussion

A dictionary version of the last known Location. The dictionary will contain two keys, latitude and longitude, which are NSNumber wrappers around doubles. Use doubleValue to retrieve.

Declared In

MarketingCloudSDK+Location.h