mixpanel/mixpanel-iphone

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

tc-sgupta opened this issue · 6 comments

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:

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

@zihejia Could you please help us, how we can execute this code

if (!distinctId && NSClassFromString(@"UIDevice")) {
after adding mixpanel using SPM

It is happening because MIXPANEL_UNIQUE_DISTINCT_ID preprocessor is not defined.

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.

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

@zihejia Any update on this issue?

@tc-sgupta this is available in v4.1.0, we've added a useUniqueDistinctId parameter. See: #972