Hi everyone. I've implemented GrowthBook into my ...
# sdk-swift
c
Hi everyone. I've implemented GrowthBook into my tvOS Swift application, and feature flags work perfectly, but I'm having trouble getting experimentation to work. Whenever I create an experiment and do attribute targeting, the
trackingCallback
is never called, and the experiment doesn't work. The only way I can get it to work is by using the
user_uuid
attribute. Then the callback is called and the experiment works fine. I've tried creating many attribute types and seeing if they will match, but none work. Does anyone have any suggestions on what to do?
Copy code
if let growthBook = growthBook {
            self.growthBook = growthBook
        } else {
            let builder = GrowthBookBuilder(
                apiHost: apiHost,
                clientKey: clientKey,
                attributes: [
                    // None of these work
                    "platform": "tvos", // enum attribute type
                    "platform_is_tv_tvos": true, // boolean type
                    "is_tvos": "true" // string type
                    // If I use the user_uuid experimentation works
//               "user_uuid": "3A662C6E-0A43-4BFB-B691-B25D685CD409"
                ],
                trackingCallback: { experiment, result in
                    print("[Debug] Experiment \(experiment.key) assigned variation \(result.variationId) with result \(result.value)")
                }
            )
            let sdk = builder.initializer()
            self.growthBook = GrowthBookSDKWrapper(sdk: sdk)
        }
f
Hi Fernando, That's because your identifier attribute is user_uuid. You have to have an identifier attribute or a fallback attribute for the experiment to run as expected.
c
Hi Madhu. I got the experiment working after sending the
user_uuid
as an attribute. Thank you.