Conditionally Compiled Pods Need Formal Way to Modify PCH #539

levigroker opened this Issue Sep 21, 2012 · 8 comments


None yet

6 participants


I've a project which includes the AFNetworking pod, which requires the SystemConfiguration framework or it will not include certain symbols (AFNetworking code has #ifdef _SYSTEMCONFIGURATION_H sprinkled in) so it needs to be compiled with the SystemConfiguration.h header included. However, if I simply do a 'pod install' the Pods-prefix.pch does not include the #import <SystemConfiguration/SystemConfiguration.h> and my app will crash with an "unrecognized selector sent to instance" exception when my code tries to call the missing symbols.

If I manually add the #import statement to the Pods-prefix.pch, the all is well, but if I then do a 'pod install' again, this mod gets reverted, and I can't help but think there's a Cocoapods "way" to do this (tho I'm also wondering why it doesn't pick up this requirement automatically too).

Please see this thread:!topic/cocoapods/3j4n_fukKkw


See discussion on #529


I believe that this issue can be closed as there is support for s.prefix_header_contents = "#import <SystemConfiguration/SystemConfiguration.h>"

I can see value in being able to specify pch definitions on a per application basis instead of a per spec basis. For instance: #define MR_ENABLE_ACTIVE_RECORD_LOGGING 0 needs to be specified to silence magical record logging to the console. Perhaps a user modifiable .h file could be included in every project and imported into Pod-prefix.pch

@fabiopelosin fabiopelosin was assigned Oct 16, 2012

@Tylerc230 I agree with your points.


I believe that this issue can be closed as there is support for s.prefix_header_contents = "#import <SystemConfiguration/SystemConfiguration.h>"

@blakewatters The issue is related to configurations which thus cannot be defaulted in the podspec (like disabling the logging for Magical Record and CocoaPods/Specs#623).

So where does this stand now? Was there a solution somewhere? Is there something I can do to say the magicalrecord spec to allow the user to change #defines?

alloy commented Jan 10, 2013

@blackgold9 For the time being you could use the post_install hook to open the pch file and append to it the required defines.

NOTE: Those docs are not for the current version of CP, but for the ‘post_install’ hook it is correct.


Moving to #833

@billyto billyto added a commit to billyto/FormatterKit that referenced this issue Mar 2, 2014
@billyto billyto Adding header prefix to AddressFormatter b3bd519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment