Перейти к содержимому

Optional setup

Это содержимое пока не доступно на вашем языке.

The AffiseSettings builder (returned by Affise.Settings(...), Runtime/Affise.cs:39) exposes chainable methods for fine-tuning the initialization behavior before Start().

Class: public sealed class AffiseSettings (Runtime/Settings/AffiseSettings.cs:9).

MethodFile:linePurpose
SetProduction(bool production)Runtime/Settings/AffiseSettings.cs:40Toggle production mode (default true, line 16). Set false to enable debug APIs.
SetDomain(string domain)Runtime/Settings/AffiseSettings.cs:50Override tracking domain; trailing slash is irrelevant. Default: https://tracking.affattr.com/ (Runtime/Network/CloudConfig.cs:10).
SetPartParamName(string partParamName)Runtime/Settings/AffiseSettings.cs:59Partner parameter name.
SetPartParamNameToken(string partParamNameToken)Runtime/Settings/AffiseSettings.cs:68Partner parameter token.
SetAppToken(string appToken)Runtime/Settings/AffiseSettings.cs:77Application token.
SetOnInitSuccess(OnInitSuccessHandler)Runtime/Settings/AffiseSettings.cs:86Success callback.
SetOnInitError(OnInitErrorHandler)Runtime/Settings/AffiseSettings.cs:95Error callback.
SetConfigValue(AffiseConfig key, Object value)Runtime/Settings/AffiseSettings.cs:104Single typed configuration entry.
SetConfigValues(Dictionary<AffiseConfig, Object>)Runtime/Settings/AffiseSettings.cs:113Bulk configuration entries.
SetDisableModules(List<AffiseModules>)Runtime/Settings/AffiseSettings.cs:126Disable specific modules at runtime.
Start()Runtime/Settings/AffiseSettings.cs:172Finalize configuration and boot the SDK.

Backing DTO produced by the builder — public class AffiseInitProperties (Runtime/Init/AffiseInitProperties.cs:13).

FieldTypeDefault
AffiseAppIdstringrequired constructor argument (line 15)
SecretKeystringrequired constructor argument (line 17)
PartParamNamestring?null (line 19)
PartParamNameTokenstring?null (line 21)
AppTokenstring?null (line 23)
IsProductionbooltrue (line 25, ctor default line 45)
OnInitSuccessHandlerOnInitSuccessHandler?null (line 27)
OnInitErrorHandlerOnInitErrorHandler?null (line 29)
ConfigValuesDictionary<AffiseConfig, Object>empty dictionary (line 31)
DisableModulesList<AffiseModules>empty list (line 34)
Domainstring?null (line 40)

Public method Copy() returns a duplicate AffiseInitProperties (Runtime/Init/AffiseInitProperties.cs:129); ToJson property yields the JSONObject (line 131).

Domain override uses SetDomain(string):

Affise
.Settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey"
)
.SetDomain("https://YoureCustomDomain/") // Set custom domain
.Start(); // Start Affise SDK

Delegate types:

  • public delegate void OnInitSuccessHandler(); (Runtime/Settings/OnInitSuccessHandler.cs:3)
  • public delegate void OnInitErrorHandler(string error); (Runtime/Settings/OnInitErrorHandler.cs:3)

Wired via SetOnInitSuccess (Runtime/Settings/AffiseSettings.cs:86) and SetOnInitError (Runtime/Settings/AffiseSettings.cs:95).

Example (from; README mislabels the fence as dart, content is valid C#):

Affise
.Settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey"
)
.SetOnInitSuccess(() => {
Debug.Log("Affise: init success");
})
.SetOnInitError((error) => {
Debug.Log($"Affise: init error {error}");
})
.Start(); // Start Affise SDK

Behavior (Runtime/AffiseInternal.cs:14-36):

  • On a duplicate Start() call the error handler is invoked with AffiseError.MESSAGE_ALREADY_INITIALIZED.
  • In the Editor path, OnInitSuccess is invoked after AffiseComponent constructs successfully; a thrown exception routes to OnInitError with e.StackTrace.
  • On device, the native bridge constructs AffiseNative; the Unity-side success handler is not invoked explicitly in Runtime/Affise.cs.

Use SetDisableModules(List<AffiseModules>) to turn off bundled modules. Example:

Affise
.Settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey",
)
.SetDisableModules(new List<AffiseModules> {
AffiseModules.Persistent, // Disable module programmatically for iOS
AffiseModules.AndroidId, // Disable module programmatically for Android
})
.Start();

See Modules for per-module effects.

Setting production false enables debug APIs accessible via Affise.Debug (typed IAffiseDebugApi, Runtime/Affise.cs:234):

Affise
.Settings(
affiseAppId: "Your appId",
secretKey: "Your SDK secretKey"
)
.SetProduction(false) //To enable debug methods set Production to false
.Start(); // Start Affise SDK
Affise.Debug.Validate(status =>
{
// Handle validation status
});

IAffiseDebugApi (Runtime/Debugger/IAffiseDebugApi.cs:7):

MethodFile:line
Validate(DebugOnValidateCallback)line 14
Network(DebugOnNetworkCallback)line 21
Version() → stringline 26
VersionNative() → string?line 31

Version() returns "1.7.18" (Runtime/Debugger/AffiseDebug.cs:51).

Enum ValidationStatus (Runtime/Debugger/Validate/ValidationStatus.cs:6) — VALID, INVALID_APP_ID, INVALID_SECRET_KEY, PACKAGE_NAME_NOT_FOUND, NOT_WORKING_ON_PRODUCTION, NETWORK_ERROR, UNKNOWN_ERROR.

If a Podfile has not been generated, copy Editor/Resources/iOS/AffisePodfile.rb as a starting template.

iOS crash: NSUserTrackingUsageDescription missing

Section titled “iOS crash: NSUserTrackingUsageDescription missing”

Android 14 (API 34) crash: RECEIVER_EXPORTED

Section titled “Android 14 (API 34) crash: RECEIVER_EXPORTED”