I'm using ank's solution from this SO question: Cocoapods: turning MagicalRecord logging off which used to work well before I updated CocoaPods to the latest version (0.38.2). Now whenever I run the pod install
command it returns several errors.
For reference, here is the original Podfile snippet shared by ank (link):
post_install do |installer|
target = installer.project.targets.find{|t| t.to_s == "Pods-MagicalRecord"}
target.build_configurations.each do |config|
s = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
s = [ '$(inherited)' ] if s == nil;
s.push('MR_ENABLE_ACTIVE_RECORD_LOGGING=0') if config.to_s == "Debug";
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = s
end
end
The first problem I encounter was that project
needed to be replaced with pods_project
on the Podfile, so I did.
But the one that got me stuck is that it doesn't recognize the build_configurations
statement, as you can see on the console error bellow:
...
Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `build_configurations' for nil:NilClass
...
I have googled the issue but could not find a working solution for it neither from SO nor gitHub or other sites. I believe there might be some more changes needed in order for the snippet to work again on this version of CocoaPods so I would like to know if anyone have come up with a solution for this problem or if there is another way to turn off loggin for MagicalRecord (BTW I'm using version 2.2).
Here is the last portion of my Podfile:
post_install do |installer|
target = installer.pods_project.targets.find{|t| t.to_s == "Pods-MagicalRecord"}
target.build_configurations.each do |config|
s = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
s = [ '$(inherited)' ] if s == nil;
s.push('MR_ENABLE_ACTIVE_RECORD_LOGGING=0') if config.to_s == "Debug";
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = s
end
end
Any help will be widely appreciated :)