mixpanel / mixpanel-iphone

Official iOS (Objective-C) Tracking Library for Mixpanel Analytics
http://mixpanel.com
Apache License 2.0
1.05k stars 567 forks source link

Where do we specify preprocessor MIXPANEL_UNIQUE_DISTINCT_ID when we add mixpanel using SPM #970

Closed tc-sgupta closed 2 years ago

tc-sgupta commented 2 years ago

Integration Method: Swift Package Manager Xcode Version: 13.2.1 Library Version: 4.0.0 Platform: iOS Language: Objective-C Description: Where do we specify preprocessor MIXPANEL_UNIQUE_DISTINCT_ID when we add mixpanel using SPM Expected Behavior:

tc-sgupta commented 2 years ago

We specify using cocoapods like this

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if ['Mixpanel'].include? target.name
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'MIXPANEL_UNIQUE_DISTINCT_ID=1']
            end
        end
    end
end
tc-sgupta commented 2 years ago

@zihejia Could you please help us, how we can execute this code https://github.com/mixpanel/mixpanel-iphone/blob/b213461deae5356be7e917f1addbb3ebffe26b37/Sources/Mixpanel.m#L339 after adding mixpanel using SPM

It is happening because MIXPANEL_UNIQUE_DISTINCT_ID preprocessor is not defined.

zihejia commented 2 years ago

hi @tc-sgupta , thanks for bringing it up. We are thinking of making this configurable through API in addition to the preprocessor. So you will be able to set it when initializing the SDK.

tc-sgupta commented 2 years ago

@zihejia Thanks, that would be perfect. Is there any ETA on this?

tc-sgupta commented 2 years ago

@zihejia Any update on this issue?

jaredmixpanel commented 2 years ago

@tc-sgupta this is available in v4.1.0, we've added a useUniqueDistinctId parameter. See: https://github.com/mixpanel/mixpanel-iphone/pull/972