How to avoid "Unknown identifier" when building?

Hello,

I used iPhoneUtils class methods in my script for iOS platform game and tried to switch platform to Mac and build it. But I can't build with error: "Unknown identifier: 'iPhoneUtils'.".

How can I avoid this error without commenting this line out because maybe I will forget to remove the comment line back in iOS platform?

Thank you.

You can use platform dependent directives to wrap code that should only be executed/compiled on a particular platform:

http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html

In your case, wrap all code that is strictly for the iPhone in:

#if UNITY_IPHONE
[your code here]
#endif