Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5.0.2p2 KeyNotFoundException: The given key was not present in the dictionary.

Discussion in 'iOS and tvOS' started by CrystalDynamo, May 24, 2015.

  1. CrystalDynamo

    CrystalDynamo

    Joined:
    May 22, 2014
    Posts:
    120
    I tried just the build like you and I just get the cannot launch xcode error.

    Maybe select reimport all your assets that may help but may take some time. I think the progress meter of that is on your unity icon if you decide to run that.
     
  2. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    With Unity 5.1.1f1, I get the KeyNotFoundException error when I try to append to a build but not when I replace.
     
  3. simplypositivity

    simplypositivity

    Joined:
    Jun 22, 2015
    Posts:
    1
    This is happening for me as well, please fix! Running Unity Pro 5.1.1f1

    Bump!
     
  4. CrystalDynamo

    CrystalDynamo

    Joined:
    May 22, 2014
    Posts:
    120
  5. Andrei_Leonte

    Andrei_Leonte

    Joined:
    Mar 13, 2014
    Posts:
    14
    I was wondering if you know about this fix for not being able to launch Xcode:

    (UnityException: Launching iOS project via Xcode failed)

    By the way, I'm also struggling with the KeyNotFound error, will try 5.1.1p1 later, thanks for the tip.
     
    fschneider likes this.
  6. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
  7. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    @povilas : can you also look into the two other errors reported in this thread, most notably that KeyNotFound exception?
    *edit* The 5.1.1p1 patch did not resolve the issue for me, I'm just getting a different exception (see my previous post in this thread for more details)

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.iOS.Xcode.PBXProject.GetGroupChildrenFiles (System.String projectPath)
     
  8. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    I was not able to reproduce the issue on the newest version. This might be project-specific. Could you please submit a bug report and attach you project to it? Please post the bug number here. Thanks :)
     
  9. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    Thx, I'll try to create a demo project that can reproduce it. Can't attach my current project due to IP issues
     
  10. mydev555

    mydev555

    Joined:
    Mar 15, 2014
    Posts:
    8
    I have exactly the same problem with Unity Pro 5.1.1f1.
     
  11. OMA_Fox

    OMA_Fox

    Joined:
    May 20, 2015
    Posts:
    2
    I've been getting the same issue too for over 2 weeks now when trying to Build my project for iOS.

    Every time I want to Build my project, if I click "Append" then it will always fail in Postprocessing Player with the error message posted below, to get around this I have to choose "Replace" which is painfully slow as I then need to rebuild the whole Xcode project to run my app :(

    I am currently on patch 5.1.1p1, I haven't updated to 5.1.1p2 but looking at the release notes it does not seem like there's any mention of this problem being fixed.

    Yet from this thread it looks like I'm not the only having this issue. It would be appreciated if you guys could take a look into it, thanks!!

    Error building Player: KeyNotFoundException: The given key was not present in the dictionary.

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,UnityEditor.iOS.Xcode.PBX.PBXGroup].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    UnityEditor.iOS.Xcode.PBXProject.GroupsGetByChild (System.String childGuid)
    UnityEditor.iOS.Xcode.PBXProject.RemoveGroupIfEmpty (UnityEditor.iOS.Xcode.PBX.PBXGroup gr)
    UnityEditor.iOS.Xcode.PBXProject.RemoveFilesByProjectPathRecursive (System.String projectPath)
    UnityEditor.iOS.PostProcessiPhonePlayer.BuildXCodeProject (UnityEditor.iOS.ProjectPaths paths, UnityEditor.iOS.IncludedFileList includedFiles, System.Collections.Generic.List`1 frameworks, System.String sdkVersion, System.String targetOS, System.String productName, Boolean useIl2Cpp, Boolean installInBuildFolder, Boolean useSymlinks, Boolean isGameCenterUsed)
    UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.iOSBuildPostprocessor pp, BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()
     
    Last edited: Jul 6, 2015
  12. MarxentAnthony

    MarxentAnthony

    Joined:
    Feb 20, 2015
    Posts:
    18
    I have the same issue when Appending a build from 5.1.1f1 and Xcode 6.3 & 6.2

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,UnityEditor.iOS.Xcode.PBX.PBXGroup].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
     
    Last edited: Jul 7, 2015
  13. LeakedDave

    LeakedDave

    Joined:
    Aug 26, 2012
    Posts:
    23
    Still happening for me on 5.1.1p1

    When can this be fixed? I'm spending more time building and appending my Xcode project than I am actually working on the game itself...

    Please fix this soon.

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.iOS.Xcode.PBXProject.GetGroupChildrenFiles (System.String projectPath)
    UnityEditor.iOS.PostProcessiPhonePlayer.BuildXCodeProject (UnityEditor.iOS.ProjectPaths paths, UnityEditor.iOS.IncludedFileList includedFiles, System.Collections.Generic.List`1 frameworks, System.String sdkVersion, System.String targetOS, System.String productName, Boolean useIl2Cpp, Boolean installInBuildFolder, Boolean useSymlinks, Boolean isGameCenterUsed)
    UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.iOSBuildPostprocessor pp, BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
     
  14. vero_chan

    vero_chan

    Joined:
    Oct 29, 2013
    Posts:
    3
    I'm having this error "Error building Player: KeyNotFoundException: The given key was not present in the dictionary." too on Unity 4.6.6f2, it doesn't mind if I choose Build & Run or Build, if I select Append it crashes showing that bug. Any way to correct this? :(
     
  15. MarxentAnthony

    MarxentAnthony

    Joined:
    Feb 20, 2015
    Posts:
    18
    You can get past this with 5.1.1p3
     
  16. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    I just tried appending Xcode project generated from empty Unity project and it worked fine both with 5.1.1p1 and 4.6.7p1.
    If you are on these (or later) versions and still have issue, please bugreport it and share your case numbers. It might be specific to your project.
    Thanks!
     
  17. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    I'm almost certain that it is specific to my project, as I said I am still trying to create a demo project that will recreate the issue. (it is still happening to me with 5.1.1p3)

    I guess it is due to one of my installed add-ons failing to hook into the build's postprocessing. I currently have EveryPlay,AdColony, and Facebook installed, just to mention some.
     
  18. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    Everyplay seems to be the culprit. I have successfully reproduced the issue with an empty demo project and only Everyplay installed as an add-on. The issue has been reported under Case 710821
     
  19. snoopgroggygrog

    snoopgroggygrog

    Joined:
    Oct 23, 2014
    Posts:
    3
  20. snoopgroggygrog

    snoopgroggygrog

    Joined:
    Oct 23, 2014
    Posts:
    3
    I've filed a bug report: 711469
     
  21. Alexander_C

    Alexander_C

    Joined:
    Dec 18, 2012
    Posts:
    1
    I have tested my project with 5.1.1p1,and I found that if I appended Xcode project generated from the empty Unity project,it worked OK. But if I add the vuforia sdk 4.2.3 and then add the NGUI 3.8(only in this order) into my empty Unity Project,Appending did not work,the Consle showed :

    NullReferenceException: Object reference not set to an instance of an object

    UnityEditor.iOS.Xcode.PBXProject.GetGroupChildrenFiles (System.String projectPath)


    UnityEditor.iOS.PostProcessiPhonePlayer.BuildXCodeProject (UnityEditor.iOS.ProjectPaths paths, UnityEditor.iOS.IncludedFileList includedFiles, System.Collections.Generic.List`1 frameworks, System.String sdkVersion, System.String targetOS, System.String productName, Boolean useIl2Cpp, Boolean installInBuildFolder, Boolean useSymlinks, Boolean isGameCenterUsed)


    UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.iOSBuildPostprocessor pp, BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)


    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args)


    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)


    UnityEditor.HostView:OnGUI()


    Error building Player: NullReferenceException: Object reference not set to an instance of an object
     
  22. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    The issue has been fixed; the fix will appear in Unity 5.1.2.
     
  23. OMA_Fox

    OMA_Fox

    Joined:
    May 20, 2015
    Posts:
    2
    This does indeed appear to be fixed in 5.1.2p1!

    Thank you very much =D