Xamarin Studio: Preferences > Projects > SDK Locat

2019-09-07 13:39发布

问题:

What are you supposed to put in the Preferences > Projects > SDK Locations > Apple > "Xamarin.iOS SDK" box?

When I leave it blank, I get a green checkbox saying it found the location. However, when I try to open a project, I get:

System.NotSupportedException: Could not parse iOS version from SDK path: Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
  at MonoTouch.Hosting.IosSystem..ctor (System.String sdkPath, DeviceTrait device, MonoTouch.Hosting.Capabilities capabilities) [0x000f4] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Hosting/IosSystem.cs:184 
  at MonoTouch.Hosting.IosSystem..ctor (System.String sdkPath, DeviceTrait device) [0x00000] in <filename unknown>:0 
  at MonoTouch.Design.Client.PooledConnectionProvider+<GetConnection>c__AnonStorey51.<>m__10B () [0x00021] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/PooledConnectionProvider.cs:33 
  at MonoTouch.Design.Client.PooledConnectionProvider+Pool.Acquire () [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/PooledConnectionProvider.cs:97 
  at MonoTouch.Design.Client.PooledConnectionProvider+Pool..ctor (Int32 count, System.Func`1 acquire) [0x00020] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/PooledConnectionProvider.cs:81 
  at MonoTouch.Design.Client.PooledConnectionProvider.GetConnection (DeviceTrait device) [0x0003d] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/Connection/PooledConnectionProvider.cs:29 
  at MonoTouch.Design.Client.IPhoneDesignerService.PrefillConnectionPool (System.String sdkPath, TargetDevice projectTargetDevice) [0x0001a] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/IPhoneDesignerService.cs:82 
  at MonoTouch.Design.Client.IPhoneDesignerService.IncrementOpenProjectCount (System.String sdkPath, Int32 projectTargetDevice) [0x0004c] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/Xamarin.Designer.iOS/MonoTouch.Design.Client/IPhoneDesignerService.cs:102 
  at MonoDevelop.IPhone.IPhoneProject.OnEndLoad () [0x0003c] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Project/IPhoneProject.cs:275 
  at MonoDevelop.Projects.SolutionItem.MonoDevelop.Projects.ILoadController.EndLoad () [0x0000e] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs:877 
  at MonoDevelop.Projects.Extensions.LoadOperation.End () [0x00019] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ProjectExtensionUtil.cs:138 
  at MonoDevelop.Projects.Extensions.ProjectExtensionUtil.EndLoadOperation () [0x00042] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ProjectExtensionUtil.cs:85 
  at MonoDevelop.Projects.Formats.MSBuild.SlnFileFormat.ReadFile (System.String fileName, MonoDevelop.Projects.Formats.MSBuild.MSBuildFileFormat format, IProgressMonitor monitor) [0x0006e] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/SlnFileFormat.cs:652 
  at MonoDevelop.Projects.Formats.MSBuild.MSBuildFileFormat.ReadFile (FilePath file, System.Type expectedType, IProgressMonitor monitor) [0x00017] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildFileFormat.cs:166 
  at MonoDevelop.Projects.ProjectService.ReadFile (IProgressMonitor monitor, System.String file, System.Type expectedType, MonoDevelop.Projects.FileFormat& format) [0x0002d] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:310 
  at MonoDevelop.Projects.ProjectService.InternalReadWorkspaceItem (System.String file, IProgressMonitor monitor) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:282 
  at MonoDevelop.Projects.DefaultProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:677 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Autotools.MakefileProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs:48 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadWorkspaceItem (IProgressMonitor monitor, System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:108 
  at MonoDevelop.Projects.ProjectService.ReadWorkspaceItem (IProgressMonitor monitor, System.String file) [0x00027] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:261 
  at MonoDevelop.Ide.RootWorkspace.BackgroundLoadWorkspace (IProgressMonitor monitor, System.String filename, Boolean loadPreferences, Boolean reloading) [0x00163] in /Users/builder/data/lanes/monodevelop_private-lion-splash2/33f01126/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:593 

回答1:

You might have a corrupted install of Xcode and need to (uninstall then) re-install it. Try changing it to /Developer/MonoTouch/ and see if that works. I tried that and also leaving it blank and they both gave a green arrow and allowed me to open a project.

EDIT: I think this is a problem with your Xcode/iOS SDK installation and not your Xamarin.iOS installation. If you "Show Contents" to the Xcode.app that you are referencing, and then navigate: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ then you should see an iOS specific sdk folder. Mine is named: iPhoneSimulator6.1.sdk. I'm not sure the exact method it uses to parse the iOS version but there should be a SDKSettings.plist file that has a "Version" entry in it. That seems the most logical to me.