Config - emartech/ios-emarsys-sdk GitHub Wiki
What is Config?
Emarsys SDK now provides a solution for applicationCode and merchantId change in a convenient way, without restarting the SDK.
Use cases of applicationCode change
NoteWhen
changeApplicationCodehas been called, the SDK will log out the user and asetContactWithContactFieldValuemust be called again with the correctcontactFieldValue.
-
Turn on Mobile Engage feature
There was no
applicationCodeset in the SDK before and withConfigit can be set from nil to a valid code.
NoteIn that case when the SDK was setup with nil
applicationCode, the developer is responsible to callsetPushToken:with the valid deviceToken if it was received during when the SDK was in inactive state
-
Turn off Mobile Engage feature
Erase a previously set
applicationCodeand disable the feature by setting it to nil. -
Use a different
applicationCodeChange a previously set
applicationCodeto a new one. If there was a pushToken set, the SDK saves it, callsclearPushTokenbefore executing theapplicationCodechange and restores the original pushToken for the newapplicationCode. -
Use a different
contactFieldIdChange a previously set
contactFieldId, to use a different contactField for authentication.
Use cases of merchantId change
-
Turn on Predict feature
There was no
merchantIdset in the SDK before and withConfigit can be set from nil to a validmerchantId. -
Turn off Predict feature
Erase a previously set
merchantIdand disable the feature by setting it to nil. -
Use a different
merchantIdChange a previously set
merchantIdto a new one.
changeApplicationCode
1.1 changeApplicationCode
NoteIf any error occurs during the change process, the completionBlock will be called with an error and the Mobile Engage feature will be turned off.
Objective-C
[Emarsys.config changeApplicationCode:<applicationCode: NSString>
completionBlock:^(NSError *error) {
if(error){
NSLog(error);
}
}];
Swift
Emarsys.config.changeApplicationCode(applicationCode: applicationCodeValue.text) { error in
if error != nil {
print("\(error)")
}
}
Errors can be handled in the completionBlock.
changeMerchantId
Objective-C
[Emarsys.config changeMerchantId:<merchantId: NSString>];
Swift
Emarsys.config.changeMerchantId(<merchantId: String>)
applicationCode
Provides what is the actual applicationCode set in the SDK.
Objective-C
[Emarsys.config applicationCode];
Swift
Emarsys.config.applicationCode()
merchantId
Provides what is the actual merchantId set in the SDK.
Objective-C
[Emarsys.config merchantId];
Swift
Emarsys.config.merchantId()
contactFieldId
Provides what is the actual contactFieldId set in the SDK.
Objective-C
[Emarsys.config contactFieldId];
Swift
Emarsys.config.contactFieldId()
hardwareId
Deprecated Please use clientId instead
Provides what is the actual clientId used by the SDK. It is deprecated, please use the clientId instead.
Objective-C
[Emarsys.config hardwareId];
Swift
Emarsys.config.hardwareId()
clientId
Provides what is the actual clientId used by the SDK.
Objective-C
[Emarsys.config clientId];
Swift
Emarsys.config.clientId()
languageCode
Provides what is the actual language of the application.
Objective-C
[Emarsys.config languageCode];
Swift
Emarsys.config.languageCode()
pushSettings
Provides what is the actual notificationSettings set for the application.
Objective-C
[Emarsys.config pushSettings];
Swift
Emarsys.config.pushSettings()
sdkVersion
Provides the actual sdkVersion
Objective-C
[Emarsys.config sdkVersion];
Swift
Emarsys.config.sdkVersion()