Search Unity

Blank Unity project = 600+ warnings on XCode

Discussion in 'iOS and tvOS' started by DanielFox, Aug 12, 2015.

  1. DanielFox

    DanielFox

    Joined:
    Apr 9, 2013
    Posts:
    6
    Pretty much as the title says... I was just testing some things and I created a blank Unity3D Project, with nothing on it. Exported for XCode > Project > Run on my iPhone and I get more than 600 alerts.

    They are basically all located in .cpp files inside the Classes/Native folder and most of them are about "Value Conversion Issues".

    So... is this normal? Should I ignored them all? The project does run fine on my mobile, but all these warnings are kinda bothering me.

    Unity version: 5.1.2f1 Personal
    Xcode version: 6.4

    Thank you.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @DanielFox

    These warnings are normal, although not ideal. They are warnings in the generated C++ code created by il2cpp.exe. They should all be benign, so they can be safely ignored. At some point (hopefully soon) we will change the il2cpp.exe code generation to eliminate them.

    For the most part they occur because the CLR provides some additional guarantees that we don't properly communicate to the C++ compiler in the generated code. For example, an array index in the CLR will also fit in a 32-bit value, although in some cases a 64-bit value is used to store it. So in the generated code, il2cpp.exe just casts the 64-bit value to a 32-bit value, generating a warning.
     
    spider853, image28 and DanielFox like this.
  3. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    This post should be pinned until this issue is eliminated IMHO.
     
  4. Jamso

    Jamso

    Joined:
    May 5, 2016
    Posts:
    10
    Hi,

    I have same problem. I using Unity 5.4.1f1 and Xcode 8.2.1, create empty project with Unity, then open without Warnings/error in Xcode, but Build for device and obtain +300 Warnings of:

    *) Unused function 'InitCrash' -> CrashReporter.mm
    *) Unused function 'InitObjCUEHandler' -> CrashReporter.mm
    *) Unused variable 'iBound' -> mscorlib_ArrayTypes.h
    *) Undeclared selector 'onUnityUpdateViewLayout' -> UnityView.mm
    *) Undeclared selector 'createUnityViewImpl' -> UnityAppcontroller.mm
    *) Undeclared selector 'createViewHierarchyImpl' -> UnityAppcontroller.mm
    *) Code will never be executed:
    Bulk_Generics_0.cpp
    Bulk_Generics_1.cpp
    Bulk_Generics_2.cpp
    Bulk_Generics_3.cpp
    GenericMethods0.cpp
    *) 'extern' variable has an initializer -> Il2CppCompilerCalculateTypeValues.cpp

    How do I fix or remove these warnings of Xcode?

    Please help me!


    J
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @Jamso

    I thought that we had corrected all of the warnings in the generated C++ code, but it seems that a few may have crept back in. I'll look into corrected them soon, so a newer Unity patch release should fix this. Note that the warnings should all be benign though. If you find one that impacts the runtime behavior of the project, please file a bug report, and we will correct it.
     
  6. Jamso

    Jamso

    Joined:
    May 5, 2016
    Posts:
    10
    Very thanks JoshPeterson, if find problem file a bug report. A detail, I contact with support of Unity and never say this.

    Jaime
     
  7. rob8861

    rob8861

    Joined:
    Sep 25, 2015
    Posts:
    86
    Hello Josh,
    I just wanted to let you know that I am still getting 600+ warnings from Xcode, although the project builds and run successfully on my iPhone.
    The project is compiled with the new .net 4.6 runtime and IL2CPP.
    I was building it on Xcode 9.1 , MacOS X 10.13.1

    another issue I noticed is that by default Unity sets the default SDK to 7.0 but Xcode (9.x) no longer supports that so I was promoted to change it to 8.0, along with 13 more issues Xcode wanted to fix in the project settings. That went fine (I think) but after building the project, I got 600+ warnings. some are due to deprecated interface orientations and most of them are bulk_generic13.cpp warnings (semantic , unused entity)
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    This is something we need to correct. Which version of Unity are you using?
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Note that with 2017.2.0f3, I do see many unused variable warnings. I'll attempt to correct those. I think they can be safely ignored, as they don't indicate an undefined behavior.
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    The unused variable warnings will be removed in Unity 2018.1 (which is not out yet). Unfortunately, I don't think this is a fix we will back port though. I would recommend ignoring the warnings in Xcode. You can add the -Wno-unused-variable flag to the "Other C Flags" section of the Build Settings in Xcode (see the attached screen shot).
     

    Attached Files:

  11. svarmony

    svarmony

    Joined:
    Jan 23, 2015
    Posts:
    11
    Hey! What about the other warnings? For example the Deprecations Warnings which are coming from Unity:
    • .../Classes/Unity/UnityInterface.h:134:36: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
    • .../Classes/UI/OrientationSupport.mm:73:55: 'interfaceOrientation' is deprecated: first deprecated in iOS 8.0
    • .../Classes/UnityAppController+Rendering.mm:127:19: 'setFrameInterval:' is deprecated: first deprecated in iOS 10.0 - use preferredFramesPerSecond
    • .../Classes/Unity/WWWConnection.mm:350:52: 'initWithRequest:delegate:startImmediately:' is deprecated: first deprecated in iOS 9.0 - Use NSURLSession (see NSURLSession.h)
    • .../Classes/Unity/DisplayManager.mm:60:45: 'UIScreenOverscanCompensationInsetApplicationFrame' is deprecated: first deprecated in iOS 9.0 - Use UIScreenOverscanCompensationNone
    • .../Classes/AOT_XCode/Classes/UnityAppController.mm:166:78: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
    • .../Classes/UnityAppController.mm:237:9: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest
    • .../Classes/UnityAppController.mm:237:74: 'UIApplicationLaunchOptionsLocalNotificationKey' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]
    • .../Classes/UI/UnityViewControllerBaseiOS.mm:226:72: 'interfaceOrientation' is deprecated: first deprecated in iOS 8.0
    • .../Classes/Unity/FullScreenVideoPlayer.mm:28:5: 'MPMoviePlayerController' is deprecated: first deprecated in iOS 9.0 - Use AVPlayerViewController in AVKit.
    • ...
    Are they also gonna be fixed, is there a way we can be doing something already? In our case we have a client who is not allowing code with warnings. :'(

    Thanks in advance!

    Best regards
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    These errors are not related to IL2CPP generated code. They are in Objective-C code that ships with Unity. We clean them up as we can, but these deprecation warnings are difficult to manage, as we support multiple iOS API versions. In some, these are not deprecated, in others they are.

    I suspect your best option is to disable these specific warnings in your Xcode project. Hopefully your client will accept that.
     
  13. rob8861

    rob8861

    Joined:
    Sep 25, 2015
    Posts:
    86
    Sorry for the super late reply.
    I was using Unity 2017.2.0p1
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Can you check with a later version of Unity? If there are still there, please submit a bug report. I believe that we corrected these warnings, although I don't think the change made it in until 2018.1 (which is in beta now).
     
  15. rob8861

    rob8861

    Joined:
    Sep 25, 2015
    Posts:
    86
    Do you have any specific version in mind you'd like me to try.
    I currently have no plans to upgrade unity until 2018.1 comes out.
     
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    The latest 2018.1 beta would be the one to try. If you would like to wait until the release, that is fine as well.
     
  17. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    222
    well i have 720 warnings using unity 2018.2 any suggestions how to remove this warnings and this can cause of the rejection of the app on Apple Store ?
     
  18. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    These warnings should not cause a problem for app store submission. However, I'd like to know what is generating these warnings and correct them. Can you submit a bug report with a project that causes these warnings? We would really appreciate it.
     
  19. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    222
    ok will take note of most the warnings and the mayor part the are generated of illcp compile of the project i will try to get rid of them.
    I will post pictures this week on the forum
     
  20. TikabVR

    TikabVR

    Joined:
    Dec 15, 2016
    Posts:
    7
    This seems to still be an issue in 2018.x. Not sure how 2019 goes since our major projects are still on 2018, but I have *always* seen warnings from Unity projects in Xcode since I started building from iOS back in...2010? 2011?

    I understand most of them are benign, but it is hard to spot things that might not be when there are hundreds of unnecessary warnings...?
     
    Diphaze likes this.
  21. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    We should not have many errors in Xcode now, but maybe your project triggers something we have missed. Can you submit a bug report?
     
  22. Diphaze

    Diphaze

    Joined:
    Jul 6, 2019
    Posts:
    2
    It depends on where you put the cursor 'many' (and the 'eternity' cursor too, IMHO). To me, for an iOS project, 1 is 'many', but here, I have 604 warnings (using 2018.3.11f1)... Indeed, I have to reconsider my cursor! And continue crawling happily in warnings to sort which are benign and which are not. In regard to eternity, I have to raise my glass and wish a happy birthday to this 4-years defect still without a solution. BTW replying that "it was once corrected but it crept back" is creepy. Aren't tests done to avoid this?

    So, if you are new to Unity: don't lose time with googling each and every warning you find in your pretty Unity project in XCode: just ignore all the various warnings and cope only with the errors. Is that correct?
     
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    We don't have an active bug report for this issue. If you are able to submit a project that causes warnings with a bug report, we would like to have a look at it. We will gladly work to correct those warnings.

    Indeed, we have a number of tests which verify that the C++ code generated by IL2CPP does not produce warnings. However, two factors are in play which make this difficult. First, we can't test all possible generated C++ code, so your project may hit an as-yet untested code path. Second, we don't validate all versions of Unity against all versions of Xcode, so some Unity/Xcode combination might cause warnings that we don't anticipate.

    Iid like to see all warnings from generated code removed - we need to know about them in order to correct them though.
     
  24. Diphaze

    Diphaze

    Joined:
    Jul 6, 2019
    Posts:
    2
    Jamso provided a list of warnings above in this thread in 2016. These warnings are still there. It's hard to believe that no bug was never ever submitted for them...

    Here is my list of warnings :
    - This function declaration is not a prototype
    - This file is set to build for a version older than the deployment target. Functionality may be limited (2 occurrences fixed manually, on the Launchscreen-iPpad/iPhone.xib)
    - Undeclared selector (existed in 2016 - yet 5 occurrences in my project)
    - Code will never be executed (existed already in 2016 - yet 573 occurrences in my project)
    - ‘extern’ variable has an initializer (the same as in 2016 + 2 other occurrences)
    - 'initWithRequest:delegate:' is deprecated: first deprecated in iOS 9.0 - use NSURLSession(see NSURLSession.h) : first deprecated in iOS 9.0, no use to say more
    - control may reach end of non-void function
    - Block implicitly retains ‘self’
    - Possible misuse of comma operator here


    My warnings are not specific to my project. I'm just facing historical warnings, like the whole Unity developers community which loses thousands of hours googling for solutions to these warnings (to find that there is no solution and that 'this can be safely ignored').

    If the problem was fixed on some Unity/XCode combinations, Google searches would bring up some "OK, fixed!" pages. Unfortunately, they don't. So these problems were never fixed. I think you decided not to deal with warnings until they turn to errors. And I'd better accept this answer, rather than: "lose some more time again and send me your project". Considering the facts, submitting such a buggy project would result in nothing. These are the facts.
     
    unnanego and dragonstar like this.
  25. CarlosPolastro

    CarlosPolastro

    Joined:
    Nov 30, 2019
    Posts:
    1
    4 years later and same warnings still appearing...how to fix them?
     
    Deleted User likes this.
  26. gulfam-jadoon

    gulfam-jadoon

    Joined:
    Jul 27, 2017
    Posts:
    1
    Unity 2019.2.2.0f1

    Empty Unity Project

    Single scene with nothing in it, no not even an image or a button.

    827 warnings on Xcode ?

    This unity/Xcode thing misses up day by day.

    I think this is good time to switch from unity unto some other game engine.
     
    unnanego likes this.
  27. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    @JoshPeterson This issue is still present. An empty project generates a lot of warnings. I know, I can safely ignore them, but it would be nice, if you actually do something :)
     
  28. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    What Xcode version and Unity version were you guys using?

    There is indeed new warnings introduced by Apple in Xcode 11.4, but at least for Xcode 11.3.1 and Unity 2019.2.21, I'm only getting 74 warnings, many of which are Apple's linter fail to identify @available directive usage. So they did do something.

    I have seen none of those with my Xcode-Unity combination.
     
  29. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Changes to ignore the new warnings in Xcode 11.4 are going out in Unity releases now.
     
  30. mitsuko-ono

    mitsuko-ono

    Joined:
    Mar 9, 2021
    Posts:
    5
    This issue is still present. Should I ignore these warnings?
     
  31. Francesco-FL

    Francesco-FL

    Joined:
    May 25, 2021
    Posts:
    176
    I think so, at least I do this and I have no problems.

    Anyway I just ran a build (IL2CPP), 615 warnings in Xcode for UnityFramework
     
  32. SeaCake

    SeaCake

    Joined:
    Jul 5, 2021
    Posts:
    2
    Almost 2022 and still happening. I get 24000 warnings. Too many to the point that XCode crashes.

    They are Semantic Issues. All from Native files. (ILCPP, mscorlib etc).

    Warnings: "Code cannot be executed", "This function declaration is not a prototype"

    Edit: I have to put "-w" under Compiler Flags in Build Phases to all the Native files.
     
    Last edited: Dec 19, 2021
  33. Francesco-FL

    Francesco-FL

    Joined:
    May 25, 2021
    Posts:
    176
    @SeaCake Try submitting a bug report
     
    Last edited: Mar 3, 2022
  34. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    This does sound like a problem. Xcode should not be crashing! Please do submit a bug report (https://unity3d.com/unity/qa/bug-reporting), so that we can investigate. Thanks!
     
  35. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,431
    With all due respect, it would seem like a company the size of Unity Tech should be able to manage this with appropriate process. It's automatable. Before every release, spin up a new MacOS system of multiple flavors, install the proposed Unity Hub and IDE to each, create a project, Build, and submit every freakin' error message to the "MUST BE FIXED BEFORE RELEASE" pile. Of course you won't institute that kind of process, but it's kind of insulting to find five years of "this problem still exists" on the public forums and your chipper reaction of surprise and concern every once in a while.
     
  36. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    We do have tests to confirm that Xcode builds occur with only a known subset of warning allowed. All of the allowed warning should be benign.

    I don't believe that these warnings are one we allow though, so there may be something either in a newer version of Xcode or something specific to this project which triggers them. Hence, it is best to get a bug report so that we can investigate the specific issue.
     
  37. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,431
    Oh, that rust under the wheel wells is perfectly normal in brand new cars.

    If you want "out of box" confidence in new users, then all of the allowed warnings should be *fixed* or *suppressed*. A new user does not have the context nor the desire to seek out an explanation on an Internet forum, all they see is warnings and more warnings.
     
  38. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    True, as a new user these warnings can be daunting. I'll see if we can do better to prevent them from showing up.
     
  39. Evgeno

    Evgeno

    Joined:
    Sep 8, 2014
    Posts:
    57
    An empty Unity project URP built in version 2021.2.16f1 and the latest version of Xcode is getting 2756 warnings. Will this ever be fixed?
     
  40. Francesco-FL

    Francesco-FL

    Joined:
    May 25, 2021
    Posts:
    176
    Try sending a report, even a blank one, in which you write it.
     
  41. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    New warnings are enabled all the time as compiler upgrades. It's not possible to have a fix once and for all as no one can predict what code is considered problematic at what time, so don't worry about it as long as it does not cause issues.
     
  42. JoshuaPatrickDeveloper

    JoshuaPatrickDeveloper

    Joined:
    May 18, 2022
    Posts:
    1
    The warnings don't seem to seem to effect the play, but there seems to be a problem when I try to up load to app store.
    How is everyone else doing with up loading to app store???
     
  43. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    You maybe tell about the problem?