dannenwhite opened this Issue Feb 4, 2014 · 10 comments


None yet

7 participants


If I'm using CocoaPods, where's the best place to set this define in my workspace/project without changing the actual mixpanel pod target? Is this possible? Dumb question? :D



Go to your app's project in Xcode, click Build Settings, then search for "Preprocessor Macros". Add a new one with name MIXPANEL_NO_IFA = 1 under the build configuration(s) you want.


This never works for me, I always have to add the #define MIXPANEL_NO_IFA in Mixpanel.m


@justinmakaila CocoaPods creates build targets for each of your pods. The preprocessor directives are evaluated when the Pods-Mixpanel target is compiled, and so your preprocessor directives need to be set on that target.



I've done it so many times, I can't even count. I've also had binary after binary rejected because people say it should work and it just doesn't.

My preprocessor macros section looks exactly like yours, and yet I still get rejected for the IDFA usage.


I just realized on the screenshot I made above, the flag is on the Debug scheme, and should be also set on Release, but I'm sure you have that sorted.

I guess the next step is to try and diagnose whether the preprocessor macro is applying. here is a short clip of a project with MIXPANEL_NO_IFA = 1 that shows how the preprocessed output contains an IFA function that just returns nil and doesn't reference ASIdentifierManager. If you see a different output in the preprocessed file, please let me know.


screen shot 2014-09-22 at 7 57 31 pm
screen shot 2014-09-22 at 8 00 11 pm

I think something's wrong... @alex-hofsteede


Yeah, as I mentioned before, the preprocessor macro needs to be in the Pods-Mixpanel target, not your main application target. The Mixpanel code has already been preprocessed and compiled by the time your main app preprocessor macros are evaluated.

Sorry this isn't at all clear in the documentation, so I will try put something up there that explains this more fully.



My apologies for speed reading through it and not catching that part.


To fix this, at the bottom of your Podfile, add:

post_install do |installer|
  installer.project.targets.each do |target|
    target.build_configurations.each do |config|
      preprocessor_definitions = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
      preprocessor_definitions = ['$(inherited)'] if preprocessor_definitions == nil
      preprocessor_definitions.push 'MIXPANEL_NO_IFA' if target.to_s.include? 'Mixpanel'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessor_definitions

This will add MIXPANEL_NO_IFA to only the Mixpanel project in your Pods.xcodeproj after each pod install.

@malectro malectro closed this Feb 3, 2015
adolfo commented Aug 19, 2015

It appears that CocoaPods 0.38.x breaks this fix. The solution is to change project to pods_project.

installer.pods_project.targets.each do |target|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment