- Home /
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.
Answer by Wolfram · May 05, 2011 at 02:09 PM
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
Your answer
![](https://koobas.hobune.stream/wayback/20220613131935im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 2019 iOS build problem 0 Answers
My Mac game to iPhone. 0 Answers
XCode errors 1 Answer
Exporting my Mac game to........ 2 Answers