Originally created by @ghost on GitHub (Dec 5, 2015).
My project is configured to enable debug:
- `Armchair.debugEnabled(true)` added to my code
- corresponding "-DDebug" added to my Xcode project
On this issue https://github.com/UrbanApps/Armchair/issues/29 problem has been solved for Cocoapods. But what about Carthage?
Sorry, I am not familiar with Carthage so I don't have an exact answer, but you need to find a way to pass the compiler flags to whatever project is actually building the framework and pass the -DDebug flag there.
Please post back here for the benefit of others if you figure out how.
@coneybeare commented on GitHub (Dec 9, 2015):
Sorry, I am not familiar with Carthage so I don't have an exact answer, but you need to find a way to pass the compiler flags to whatever project is actually building the framework and pass the `-DDebug` flag there.
Please post back here for the benefit of others if you figure out how.
I think that the framework must not check "Debug" flag, but let the caller do the job
It's more a main project issue to know the mode, the configuration bool is sufficient for the framework
in my code I prefer to use my own flag (name) put only in debug scheme, not in release
#if DEBUG // or TEST or TESTARMCHAIR
Armchair.debugEnabled(true)
#endif
With dependencies manager like cocoapod or carthage it's seems not straightforward to add a compil flag automatically
Even If we find a way, the flag will be put for debug and release and no more check will be done (even in release) except if there is config for each scheme...
carthage : I make some google search without result yet
I know that we could be disagree because have each time a prompt for rate in a release app will be a big annoyance and maybe many people then will give a lower rate because of that
But I have trust in developpers, maybe I am wrong!!!
Other idea, keep the current code and add an other method not documented in README
for instance unsafeDebugEnabled(..Bool)
maybe a tag to make a warn when compiling
There is another issue that can fix this issue, debugEnabled is used for two things :
activate debug log
show always prompt
2 variables will be better or 1 variable for logging and one piece of code to show always prompt with preprocessor macro
@phimage commented on GitHub (Dec 10, 2015):
I think that the framework must not check "Debug" flag, but let the caller do the job
It's more a main project issue to know the mode, the configuration bool is sufficient for the framework
in my code I prefer to use my own flag (name) put only in debug scheme, not in release
```
#if DEBUG // or TEST or TESTARMCHAIR
Armchair.debugEnabled(true)
#endif
```
With dependencies manager like cocoapod or carthage it's seems not straightforward to add a compil flag automatically
Even If we find a way, the flag will be put for debug and release and no more check will be done (even in release) except if there is config for each scheme...
- sample for cocoapod (maybe there is more short code): https://github.com/OAuthSwift/OAuthSwift/wiki/Work-with-application-extension
- carthage : I make some google search without result yet
I know that we could be disagree because have each time a prompt for rate in a release app will be a big annoyance and maybe many people then will give a lower rate because of that
But I have trust in developpers, maybe I am wrong!!!
---
Other idea, keep the current code and add an other method not documented in README
for instance unsafeDebugEnabled(..Bool)
maybe a tag to make a warn when compiling
---
There is another issue that can fix this issue, debugEnabled is used for two things :
- activate debug log
- show always prompt
2 variables will be better or 1 variable for logging and one piece of code to show always prompt with preprocessor macro
I disagree. This way automatically prevents log spam on production builds, even if the developer accidentally left in a debug line.
@coneybeare commented on GitHub (Mar 16, 2016):
I disagree. This way automatically prevents log spam on production builds, even if the developer accidentally left in a debug line.
Doing this will solve the carthage issue. Otherwise you have to specify "carthage build -configuration Debug". I think it creates more confusion that the benefit it brings.
@fotiDim commented on GitHub (Mar 16, 2016):
Doing this will solve the carthage issue. Otherwise you have to specify "carthage build -configuration Debug". I think it creates more confusion that the benefit it brings.
Well, my opinion is that it is still better the current way, but because the Carthage and Cocoapods frameworks don't seem to have easy support for adding compiler flags yet, I am open to changing it until they do.
Please feel free to send over a pull request removing the DEBUG flag behavior, and an updated README to reflect the changes.
@coneybeare commented on GitHub (Mar 16, 2016):
Well, my opinion is that it is still better the current way, but because the Carthage and Cocoapods frameworks don't seem to have easy support for adding compiler flags yet, I am open to changing it until they do.
Please feel free to send over a pull request removing the DEBUG flag behavior, and an updated README to reflect the changes.
@inket commented on GitHub (May 6, 2016):
For now you can force debug mode by doing this
``` swift
let manager = Manager.defaultManager
let ivar: Ivar = class_getInstanceVariable(manager.dynamicType, "debugEnabled")
let fieldOffset = ivar_getOffset(ivar)
let pointerToInstance = unsafeAddressOf(manager)
UnsafeMutablePointer<Bool?>(pointerToInstance + fieldOffset).memory = true
```
To enable the debug mode of Armchair, you have to add --configuration Debug to your carthage build command
@Paul-tag2me commented on GitHub (Sep 16, 2016):
To enable the debug mode of Armchair, you have to add `--configuration Debug` to your carthage build command
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @ghost on GitHub (Dec 5, 2015).
My project is configured to enable debug:
Armchair.debugEnabled(true)added to my codeOn this issue https://github.com/UrbanApps/Armchair/issues/29 problem has been solved for Cocoapods. But what about Carthage?
@coneybeare commented on GitHub (Dec 9, 2015):
Sorry, I am not familiar with Carthage so I don't have an exact answer, but you need to find a way to pass the compiler flags to whatever project is actually building the framework and pass the
-DDebugflag there.Please post back here for the benefit of others if you figure out how.
@ghost commented on GitHub (Dec 9, 2015):
My first idea was to add this flag on the Armchair project. I am not familiar with Carthage too!
@phimage commented on GitHub (Dec 10, 2015):
I think that the framework must not check "Debug" flag, but let the caller do the job
It's more a main project issue to know the mode, the configuration bool is sufficient for the framework
in my code I prefer to use my own flag (name) put only in debug scheme, not in release
With dependencies manager like cocoapod or carthage it's seems not straightforward to add a compil flag automatically
Even If we find a way, the flag will be put for debug and release and no more check will be done (even in release) except if there is config for each scheme...
I know that we could be disagree because have each time a prompt for rate in a release app will be a big annoyance and maybe many people then will give a lower rate because of that
But I have trust in developpers, maybe I am wrong!!!
Other idea, keep the current code and add an other method not documented in README
for instance unsafeDebugEnabled(..Bool)
maybe a tag to make a warn when compiling
There is another issue that can fix this issue, debugEnabled is used for two things :
2 variables will be better or 1 variable for logging and one piece of code to show always prompt with preprocessor macro
@fotiDim commented on GitHub (Mar 16, 2016):
It is better to do a runtime check and not a compile time check
@coneybeare commented on GitHub (Mar 16, 2016):
I disagree. This way automatically prevents log spam on production builds, even if the developer accidentally left in a debug line.
@fotiDim commented on GitHub (Mar 16, 2016):
Doing this will solve the carthage issue. Otherwise you have to specify "carthage build -configuration Debug". I think it creates more confusion that the benefit it brings.
@coneybeare commented on GitHub (Mar 16, 2016):
Well, my opinion is that it is still better the current way, but because the Carthage and Cocoapods frameworks don't seem to have easy support for adding compiler flags yet, I am open to changing it until they do.
Please feel free to send over a pull request removing the DEBUG flag behavior, and an updated README to reflect the changes.
@inket commented on GitHub (May 6, 2016):
For now you can force debug mode by doing this
@Paul-tag2me commented on GitHub (Sep 16, 2016):
To enable the debug mode of Armchair, you have to add
--configuration Debugto your carthage build command