Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by shefyg · Oct 23, 2014 at 12:39 PM · iphonebuild-errorwindows

Get error on iPhone (Sealed Class) when trying to build iOS Game for Windows

The code:

 if (Application.platform == RuntimePlatform.IPhonePlayer) {
             int defaultFontSize = 32;
 
             if(iPhone != null && iPhone.generation.ToString().IndexOf("iPad") >=0)
                 defaultFontSize = 64;

The Error:

Assets/scripts/GameManager.cs(133,28): error CS0103: The name `iPhone' does not exist in the current context

Please advice,

Thanks, Shefyg

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by asafsitner · Oct 23, 2014 at 12:42 PM

The first thing I'd do is take a look at conditional compile directives.
So instead of

 if (Application.platform == RuntimePlatform.IPhonePlayer)
 {
     // iPhone-specific code
 }

I'd do

 #if UNITY_IPHONE
 // iPhone-specific code
 #endif


Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Landern · Oct 23, 2014 at 12:46 PM 2
Share

@asafsitner, i added a link to the directives in the documentation.

avatar image asafsitner · Oct 23, 2014 at 09:40 PM 0
Share

@Landern of course, thanks! I totally forgot to do that.

avatar image dasm30 · Dec 05, 2016 at 07:03 AM 0
Share

Hi, so I have Unity 5.4.3 ( $$anonymous$$ac 10.11.4 El Capitan ) and I'm getting this error when building, everything works in the editor.

alt text

 #if DEVELOP$$anonymous$$ENT_BUILD
             if( anyDeviceIsTestDevice )
             {
         #if UNITY_ANDROID
                 adRequest.TestDevices.Add( I$$anonymous$$EI_Handler.GetDeviceID() );
         #elif UNITY_IOS
                 adRequest.TestDevices.Add( iPhone.advertisingIdentifier );
         #endif
             }
             else for( int i=0; i<testDeviceIds.Length; i++ )
             {
                 if( !string.IsNullOrEmpty( testDeviceIds[i] ) )
                 {
                     adRequest.TestDevices.Add( testDeviceIds[i] );
                 }
             }
         #endif
avatar image dasm30 · Dec 05, 2016 at 07:33 AM 0
Share

Hi, so I have Unity 5.4.3 and this code which throws same error when compiling even though I have the preprocessor directive defined.

 #if DEVELOP$$anonymous$$ENT_BUILD
             if( anyDeviceIsTestDevice )
             {
         #if UNITY_ANDROID
                 adRequest.TestDevices.Add( I$$anonymous$$EI_Handler.GetDeviceID() );
         #elif UNITY_IOS
                 adRequest.TestDevices.Add( iPhone.advertisingIdentifier );
         #endif
             }
             else for( int i=0; i<testDeviceIds.Length; i++ )
             {
                 if( !string.IsNullOrEmpty( testDeviceIds[i] ) )
                 {
                     adRequest.TestDevices.Add( testDeviceIds[i] );
                 }
             }
         #endif

And yes, the code compiles in Unity Editor with no issues, the error comes when I build. alt text

Any ideas?

screenshot-2016-12-05-025959.jpg (37.5 kB)
avatar image guneyozsan · Jul 13, 2017 at 05:50 PM 0
Share

For me Unity versions from 5.6.0 to 2017.1.0f1 iOS builds doesn't respect DEVELOP$$anonymous$$ENT_BUILD directive regardless of "Development Build" option is checked or not. It always skips.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Game is running in the editor but it isn't running when built. 0 Answers

vcredist.exe does not exist using ARToolKit 0 Answers

Build for linux in windows fails: Burst requires gcc/clang toolchains to be installed 2 Answers

Can I use unity as a portable editor by copying it from my windows computer to use it on a Mac thats in my college? 1 Answer

Game not working after build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges