Cocoapods: Cocoapods adds DEBUG flag to release configurations!!!

Created on 24 Apr 2016  路  12Comments  路  Source: CocoaPods/CocoaPods

What did you do?

Run pod install

What did you expected to happen?

Install all pod dependencies correctly.

What happened instead?

Cocoapods installed the dependencies and added 'DEBUG' flag to release configurations which causes the app to run in debug mode instead of release mode.

Podfile

platform :ios, '8.0'
use_frameworks!

target 'Project' do
pod 'Kingfisher', '~> 2.1.0'
pod 'Mantle', '~> 2.0.4'
pod 'DateTools', '~> 1.6.1'
pod 'Crashlytics', '~> 3.7'
pod 'Google/Analytics'
pod 'SnapKit', '~> 0.18.0'
pod 'Adjust', '~> 4.5'
pod 'FBSDKLoginKit', '~> 4.9'
pod 'Fabric', '~> 1.6'
pod 'TwitterKit', '~> 1.15'
pod 'PySwiftyRegex', '~> 0.2.2'
pod 'Loggerithm', '~> 1.3.1'
pod 'Watchdog', '~> 2.0'
pod 'Alamofire', '~> 3.3.0'
pod 'PromiseKit/CorePromise', '~> 3.1.0'
pod 'SwiftyAttributes', '~> 1.0'
pod 'Caishen', '~> 1.1.0'
pod 'CardIO', '~> 5.3.2'
pod 'KeychainAccess', '~> 2.3'
end

target 'ProjectTests' do
pod 'Mantle', '~> 2.0.4'
pod 'DateTools', '~> 1.6.1'
pod 'SnapKit', '~> 0.18.0'
pod 'PySwiftyRegex', '~> 0.2.2'
pod 'KeychainAccess', '~> 2.3'
pod 'Caishen', '~> 1.1.0'
end

Please check attached screenshot, this what happened after running pod install:

screen shot 2016-04-24 at 09 52 43

discussion

Most helpful comment

@honghaoz I was just running into the same issue, actually this will work:

s.pod_target_xcconfig = {
    'OTHER_SWIFT_FLAGS[config=Debug]' => '-D DEBUG'
  }

It will create it in your Module.xcconfig file, will not appear on the build settings though.

All 12 comments

Weird! Can you please make a sample app to showcase this? It seems very strange, can you also say what version of CocoaPods too please

Yea I know it's weird, this is the fist time happens to me with cocoapods and I had to reject my app from the store because of this.

I will try to reproduce this with new project and share the results with you.
I'm using version 0.39.0

Thanks

@orta I created a new clean project and then Run pod install with the same podfile, so cocoapods added the DEBUG flag to develop and release configurations. I checked every dependancy I'm using and I found that cocoapods added the flag because of Loggerithm dependancy.

with Loggerithm:
screen shot 2016-04-24 at 10 56 12

after removing Loggerithm:
screen shot 2016-04-24 at 11 11 37

we also found this in the repo:
https://github.com/CocoaPods/Specs/blob/e187366577d112519af7c75d5eb35c583759103e/Specs/Loggerithm/1.3.1/Loggerithm.podspec.json

they are adding this flag for all configurations.

thanks

Ah yeah, that's a shame! I think it would be a good idea to contact @honghaoz about changing that.

@segiddins opinions on adding a linter check for something like this?

@orta yea we did contact him, I checked also different libraries and there are also couple of them doing the same.

While that's unfortunate, I don't think we should start policing individual build flags. There's a lot of custom flags which may or may not be appropriate in some situations, e.g. maybe this was even added because the Swift compiler crashed in release mode?

@mohammad19991 Sorry for my fault. I've removed that flag in pod spec and have updated the version.

try pod 'Loggerithm', '~> 1.3', it won't add DEBUG flag into the project.

Btw, how can I add a flag only in debug?

seems like "OTHER_SWIFT_FLAGS[config=Debug]": "-D DEBUG" doesn't work for me

@honghaoz Thanks 馃憤

Alright, I'm going to close this, I think @neonichu is right 馃憤

@honghaoz I was just running into the same issue, actually this will work:

s.pod_target_xcconfig = {
    'OTHER_SWIFT_FLAGS[config=Debug]' => '-D DEBUG'
  }

It will create it in your Module.xcconfig file, will not appear on the build settings though.

@sergiofraile is it working?

@RafaelPlantard So far it's been working for me with no issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

k06a picture k06a  路  3Comments

pallaviMN picture pallaviMN  路  3Comments

tlandsmancars picture tlandsmancars  路  3Comments

dawnnnnn picture dawnnnnn  路  3Comments

evermeer picture evermeer  路  3Comments