DEBUG preprocessor macro not defined for CocoaPods targets

后端 未结 5 783
灰色年华
灰色年华 2020-12-29 07:01

I\'m having issues with a pod called DCIntrospect-ARC which should only work in DEBUG mode. It checks if the DEBUG macro is defined before running. However, it is not define

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 07:28

    The accepted answer as of now doesn't work for Swift Pods. Here is a one-line change to that answer that appears to work for both.

        post_install do |installer_representation|
            installer_representation.pods_project.targets.each do |target|
                target.build_configurations.each do |config|
                    if config.name != 'Release'
                        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1']
                        config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-DDEBUG']
                    end
                end
            end
        end
    

提交回复
热议问题