Closed nataliachodelski closed 8 years ago
So i finally figured this out with the help of a fellow githubber. Having never used a custom complier flag before, this was confusing to find, set, and set correctly.
So here is how to add this debug flag to the Armchair cocoapod. FYI: You use debug mode to test out Armchair. Enabling debug mode makes Armchair show prompts immediately, without it having to meeting your usual prompting pre-conditions. You need to tell Armchair you're running the app in debug mode by setting a custom complier flag. Just building the app in debug ('testing' mode) in Xcode isn't enough for Armchair to recognize this.
To add a "-DDebug" (case sensitive) flag to Custom Complier Flags section of build settings for the Armchair pods project.
Now, use the search box to search for "flags". You may need to select show 'All' options at the top, to find this entry. the "Swift Compiler - Custom Flags" section should be at the very bottom of the list. You may need to click on "Other Swift Flags" to show the 'debug' and 'release' options - notice the drop down arrow that makes these two options visible.
Once you see that, double-click on the debug row to bring up a little box where you enter the flags you're adding. Tadd a row, click the + arrow at the bottom of the box, and add text, and then click out of the edit field do add that row. then repeat with the + icon to add the other rows.
Add these 3 rows: "-D", then "COCOAPODS" and then "-DDebug", as shown below. Make sure you add this only to the Debug row so that Debug mode is only enabled when you build your app for testing, not on Release builds as well (Release would be when you compile an archive of your app for the app store)
I've tried about 3 different methods of trying to add the -DDebug flags to allow testing of the Armchair prompts. No matter what I've tried i get the "Debug is disabled on release builds. If you really want to enable debug mode, add "-DDebug" to your Swift Compiler - Custom Flags section in the target's build settings for release" message when the app starts. Am i doing anything wrong?
What I have tried so far:
1) I thought I had found the Custom Compiler Flags area in the Pods Project Settings (images below), but Armchair rating prompt is still not showing and now i get the above "Debug Warning" message 2 x when the project builds.
2) I also tried this ruby script in my podfile to set the Debug flags for the cocoapods when the pods are installed. Again no changes in Armchairs' error message when i build the app.
3) I found and explored the Schemes area and can confirm that i'm DEFINITELY building and running the app in debug mode, not release mode (and yet still get that message each time which suggests Armchair thinks i'm running a release build).
4) In the end, I actually had to unlock and edit the Armchair.swift file so that debug mode is set regardless of whether the Debug flag is actually recognized [
Manager.defaultManager.debugEnabled = debugEnabled
]. Obviously I know this is not how i'm supposed to do this and will of course revert the file after, but this was seriously the only way I found to test the Armchair prompts. And once i made this change, Armchair debug mode worked perfectly and I was able to tweak the rating prompt.So if anyone has feedback or advice on what I might be doing wrong or why Armchair isn't recognizing my debug flags when set in the Pods Build settings, that would be very helpful.
About my system: Xcode 7.3, building for iOS 9.3 and testing on Simulator iPhone 5S.