1

Firstly, it may be helpful for you to have the relevant environment details to rule out environmental factors:

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)

Looking through SO I can't resolve the issue via the following questions here, here and generally within the Xamarin documentation here.

I have experienced this error in Xamarin.iOS when building:

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 ==========

I have a ViewController named MainViewController which is blank, save for a UIButton named MenuButton which my MainViewController.designer.cs says is correctly attributed as an [Outlet].

I CTRL + LEFT CLICKED from MenuButton in Main.storyboard and correctly dragged to the NavigationDropdownViewController which created the Segue. I named this segue NavigationMenuSegue.

Image shoing segue from MainViewController to NavigationBarDropdownViewController

Within the Widget tab I set the following:

Segue properties

If I choose either "Present As Popover" from the "Adaptive Segue" tree or the "Popover" from the "Deprecated Segues" tree, the build action encounters the error above.

Oddly, if I choose the "Present Modally" or "Push" options the drop down appears on clicking the MenuButton - albeit in the wrong position! Essentially I want it to toggle as a popover with a caret pointing towards the menu button (this is what was asked of me!)

All I want is the drop down menu to appear below the MenuButton much in the same style as a hamburger web based menu does... I am concerned that this is not an isolated issue according to Xamarin's Bugzilla here

In Xcode I could simply drop Views and work with .xibs to easily segue - I just don't seem to be understanding Xamarin's designer perhaps.

Here is my 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;
        }
    }
}

The 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
        }
    }

Is the Popover Segue build error a bug in the framework or am I going down the wrong path entirely in creating what is a very simple Menu -> Dropdown UI pattern!

Thanks for taking the time to read this and contributing towards a solution - cause I can't afford to lose any more hair over this!

John

Community
  • 1
  • 1
o-o-awake-o-o
  • 397
  • 1
  • 3
  • 18

1 Answers1

2

Okay,

I'm hoping this helps anyone else experiencing this issue using the Xamarin.IOS designer.

I understand from speaking with a Xamarin developer that the issue has now been resolved in the latest 4.1.x build (which is currently in their Beta channel). However, those who would rather use a stable build (i.e. 4.0.x) then follow these steps to resolve the anonymous build error:

Firstly, select the UI element you wish to trigger the Popover, in my case it was the MenuButton. Note the LocalizationID, you can find this by clicking the element within the designer and viewing the "Properties" window. In my case the MenUButton's LocalizationID was 204:

enter image description here

Now click on the Segue and again navigate to the "Properties" window. Select "Present As Popover" from the "Segue" drop down.

Next, insert the LocalizationID for the tigger (in my case MenuButton's ID). Note that the ID must be enclosed within ["INSERT_YOUR_LOCALIZATION_ID_HERE"] so in my example I entered ["204"]:

enter image description here

After following these steps the project will build and the Popover will function correctly.

Happy days.

o-o-awake-o-o
  • 397
  • 1
  • 3
  • 18