【发布时间】:2016-05-12 19:01:22
【问题描述】:
首先,有相关的环境细节排除环境因素可能对您有帮助:
Dev PC Environment
_______________________
Windows 10 Enterprise 64 Bit
Intel Core i7 3.40GHz 16GB RAM
Visual Studio Professional 2015 Version 14.0.25123.00 Update 2
Xamarin 4.0.3.214 (0dd817c)
Xamarin.iOS 9.6.1.8 (3a25bf1)
Macbook (Agent) Environment - used to build and simulate
______________________
OS X El Capitan Version 10.11.4
Simulator Version 9.3
Xcode Version 7.3 (7D175)
查看所以我无法通过以下问题here、here 以及通常在 Xamarin 文档here 中解决问题。
我在构建时在 Xamarin.iOS 中遇到了这个错误:
1>------ Build started: Project: App5.iOS, Configuration: Debug iPhone ------
1> Generated session id: 22824a3fd65b76ad8c03fd7694e35be1
1> Generated build app name: App5iOS
1> Connecting to Mac server 192.168.1.197...
1> C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(997,3): error :
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
我有一个名为 MainViewController 的 ViewController,它是空白的,除了一个名为 MenuButton 的 UIButton,我的 MainViewController.designer.cs 说它被正确地归因于 [Outlet]。
我 CTRL + LEFT CLICKED 从 MenuButton 到 Main.storyboard 并正确拖到创建 Segue 的 NavigationDropdownViewController。我将此segue命名为NavigationMenuSegue。
在Widget 标签中,我设置了以下内容:
如果我从“Adaptive Segue”树中选择“Present As Popover”或从“Deprecated Segue”树中选择“Popover”,则构建操作会遇到上述错误。
奇怪的是,如果我选择“以模式呈现”或“推送”选项,下拉菜单会在单击 MenuButton 时出现 - 尽管位置错误!本质上,我希望它作为一个弹出框切换,插入符号指向菜单按钮(这就是我的要求!)
我想要的只是出现在MenuButton 下方的下拉菜单,其样式与基于汉堡包的 web 菜单的样式非常相似...我担心这不是 Xamarin 的 Bugzilla here 的孤立问题
在 Xcode 中,我可以简单地删除 Views 并使用 .xibs 来轻松地进行 segue - 我似乎并不理解 Xamarin 的设计器。
这是我的 MainViewController.cs
partial class MainViewController : UIViewController
{
public MainViewController (IntPtr handle) : base (handle)
{
}
}
[Register ("MainViewController")]
partial class MainViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIButton MenuButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIView MainView { get; set; }
void ReleaseDesignerOutlets ()
{
if (MenuButton != null) {
MenuButton.Dispose ();
MenuButton = null;
}
if (MainView != null) {
MainView.Dispose ();
MainView = null;
}
}
}
NaviagationBarDropdownViewController.cs
[Register ("NavigationBarDropdownViewController")]
partial class NavigationBarDropdownViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIButton LogoutButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIImageView LogoutIcon { get; set; }
// omitted the other [Outlet]s for the five other buttons in the view for brevity
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIView NavigationBarDropdownView { get; set; }
void ReleaseDesignerOutlets ()
{
// omitted for brevity
}
}
Popover Segue 构建错误是框架中的错误,还是我在创建非常简单的 Menu -> Dropdown UI 模式时完全走错了路!
感谢您花时间阅读本文并为解决方案做出贡献 - 因为我不能再为此失去头发!
约翰
【问题讨论】:
标签: c# ios xamarin segue viewcontroller