4.3.1 UNITY_IPHONE symbol not always present during [PostProcessBuild]

We have a really weird error that I haven’t been able to figure out. We are making iOS builds with Jenkins, and intermittently, some code encased within an #if UNITY_IPHONE directive does not execute, and the #else code does. Due to the requirements of this code, it then later causes the entire build to fail.

I know there is a way to check if you are in the editor or not, but is there a way to determine what symbol is set? Or is there something else I can check/log/verify to help track this down?

Thanks

EDIT: Because I hate it when someone just replies “Nevermind, I fixed it!”

To fix this, we basically worked around the issue by changing the #if directive to an inline if:

if (target == BuildTarget.iPhone)
{
    // code....
}

Fortunately, the build target was being passed as a parameter to the function.

The reason the issue was intermittent was that on a fresh workspace, Unity wasn’t entering iPhone build mode at the required point in time. However, since Unity restarts in the same mode as its last shutdown, subsequent builds on an already attempted workspace would work.

well, yeah - i would advise against using defines for this purpose - anything related to build should use build target