-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyNotFoundException when using Unity 4.5 #33
Comments
Found it. The key it's looking for was a PBXVariantGroup. Specifically the InfoPlist.strings that's been added to the Tests target. Must be something Unity added in 4.5? Anyway, MrTact's pull request in #30 helps solve that problem, then a couple more surface because XUPorter isn't handling PBXTargetDependency and PBXContainerItemProxy regions in the consolidate method. Adding a getter (and the class if it needs it) to pull those out of the _objects PBXDictionary and adding them back in the consolidate method fixes the issue. |
Hey, Can you make a branch with the changes that you made to solve this issue? I am running into the same issue and it would save me a lot of time to see exactly how you solved the problem. Thanks, |
Made a branch. I think my working version of XUPorter was out of date because there's a lot of changes in my commit that I didn't make. But it's there for your reference. |
Hmmm, so I grabbed the changes that were on your branch, and I am still seeing the same Key Not Found issue. Here is the exact log, incase I am seeing something different than what you were seeing. KeyNotFoundException: The given key was not present in the dictionary. |
That looks like the same error I had. Maybe you're using even more fancy Xcode project trickery than I am. I'll tell you how I went about debugging the problem and maybe you'll be able to find out what the problem is. First, I generate the Xcode project WITHOUT XUPorter doing it's thing (comment out its OnPostProcessBuild stuff). Go grab your pbxproj file and save it somewhere safe. Then re-enable the XUPorter stuff and print out the key it's complaining about. Go into the original Xcode project file and find the references to that key. Chances are that key is an interesting object that maybe the 'consolidate' method didn't know how to handle. If so, you can add an empty class for its type (the 'isa' key) and some getters. If you're still having problems, send me all the info you've found and I'll see if I can help. |
I am still looking into this, but just wanted to know if you were attempting to add Frameworks to the project and libraries to the project using this as well? Looks like mine is failing when it attempts to add the frameworks. |
Yeah, I add both frameworks and libraries. |
Hmmm, that interesting. Following the instructions you stated before I am seeing that the guid that it is continuously failing on is the Frameworks guid (5623C57017FDCB0800090B9E). I am going to need to take a closer look into how this handles the frameworks. Also which version of Unity exactly are you using? |
In my project file I have Frameworks the PBXGroup and Frameworks the PBXFrameworksBuildPhase. If you have a different one then that could be the problem. I'm using Unity 4.5.0f6. |
Nope, mine is coming from PBXFrameworksBuildPhase. For whatever reason, it looks like it is registered twice in the pbxproj file, and in the new file it goes by a different guid than in the old file. |
Hmm weird. You could try ignoring that key in the new file. If it's registered twice maybe you don't need it? |
And, I was completely wrong and looking in the total wrong area. I am actually running into the same issue you stated in your second post with the InfoPlist.strings reference. I will take a look at commit #30 and see if if there is something missing. I am assuming that you included that commit in the version that you gave me that link for right? Otherwise I will just grab that this morning and merge it. |
Yeah #30 is in my branch. I hope nothing was missed, but my local XUPorter was different than the fork off of the latest commit here, so maybe in my merge something happened? |
I am not sure, I just grabbed yours and commit #30 and merged them. Now I am getting past that previous error. However, I can get a working XCode project now, but it now longer includes any of the files that it were previously bering adding into a group for me before. I am looking into that now. |
Alright, finally got everything working! Thank you very much for the help. |
You're welcome. Glad you got it working. |
josh-ruis can you commit your working version of XUPorter? thanks |
You can find my version of the repo here: https://github.com/josh-ruis/XUPorter |
After upgrading my Unity to 4.5, I'm now getting this error when I build my project for iOS. It results in an empty pbxproj file. Project still builds fine on another machine running Unity 4.3.4. I'm on Mac OS X 10.9.3 and tried both XCode 5.1.1 and the XCode6 beta.
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary 2[TKey,TValue].get_Item (.TKey key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
UnityEditor.XCodeEditor.PBXResolver.ResolveName (System.String guid) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:49)
UnityEditor.XCodeEditor.PBXResolver.ResolveName (System.String guid) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:53)
UnityEditor.XCodeEditor.PBXParser.GUIDComment (System.String guid, System.Text.StringBuilder builder) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:218)
UnityEditor.XCodeEditor.PBXParser.SerializeString (System.String aString, System.Text.StringBuilder builder, Boolean useQuotes, Boolean readable) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:546)
UnityEditor.XCodeEditor.PBXParser.SerializeDictionary (System.Collections.Generic.Dictionary`2 dictionary, System.Text.StringBuilder builder, Boolean readable, Int32 indent) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:481)
UnityEditor.XCodeEditor.PBXParser.SerializeValue (System.Object value, System.Text.StringBuilder builder, Boolean readable, Int32 indent) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:439)
UnityEditor.XCodeEditor.PBXParser.SerializeDictionary (System.Collections.Generic.Dictionary 2 dictionary, System.Text.StringBuilder builder, Boolean readable, Int32 indent) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:489)
UnityEditor.XCodeEditor.PBXParser.SerializeValue (System.Object value, System.Text.StringBuilder builder, Boolean readable, Int32 indent) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:439)
UnityEditor.XCodeEditor.PBXParser.Encode (UnityEditor.XCodeEditor.PBXDictionary pbxData, Boolean readable) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/PBX Editor/PBXParser.cs:177)
UnityEditor.XCodeEditor.XCProject.CreateNewProject (UnityEditor.XCodeEditor.PBXDictionary result, System.String path) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/XCProject.cs:614)
UnityEditor.XCodeEditor.XCProject.Save () (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/XCProject.cs:639)
XCodePostProcess.OnPostProcessBuild (BuildTarget target, System.String path) (at Assets/Libraries/CrossPlatform/Scripts/Editor/XUPorter/XCodePostProcess.cs:35)
UnityEditor.HostView:OnGUI()
The text was updated successfully, but these errors were encountered: