Skip to content

Destination plugin calls update(settings:) multiple times #42

@tcldr

Description

@tcldr

Describe the bug
The included AppsFlyer example currently results in the plugin reaching an indeterminate state.

I'm not sure whether this is because the example needs to be re-architected, or because the plugin architecture is not behaving as it was designed.

My expectation is that the set-up for AppsFlyer should always be done prior to AppsFlyerLib.shared().start() being called.

However, with the current example this isn't guaranteed.

From my observations on an iPhone X and iPhone 7 Plus, I can see that update(settings:) is often called twice. This is the method that contains the AppsFlyer set-up code.

The first time it is called is prior to the plugin's applicationDidBecomeActive(application:) method being called. This would be what I expect, but at this point Segment doesn't appear to have loaded the AppsFlyer specific settings and so the majority of this method's execution, and therefore the AppsFlyer set-up, is skipped.

Shortly after, applicationDidBecomeActive(application:) is then called. This invokes AppsFlyerLib.shared().start(), but as the settings were missing previously, AppsFlyer is started without necessary setup having taken place.

So when update(settings:) is called a second time, this time with the associated AppsFlyer settings, the plug-in doesn't behave as expected. For example, the AppsFlyerLibDelegate method onConversionDataSuccess(_:) may not get called at all.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions