Forum Xamarin Xamarin.iOS

Unable to perform push segue

TimothyTimothy USUniversity ✭✭
edited April 2014 in Xamarin.iOS

Hello,

I have attempted to utilize a push segue in one of my larger applications. I was getting an error when I attempted to push the segue using this.PerformSegue(SegueID,this);. I ended up creating a much smaller project in an attempt to see if I could get the push segue to work. I find it odd that I get an error due to the fact that I have used push segues in this exact same manner before with other apps. I have attached the error message as well as the small test project. Does anyone have any ideas as to what the issue could be?

Thanks in advance!

Posts

  • TimothyTimothy USUniversity ✭✭
    edited April 2014

    I've still been unable to find a solution to this issue. Has anyone experienced anything similar to this before?

  • TimothyTimothy USUniversity ✭✭
    edited April 2014

    Jon,

    Thanks for the help. Making the changes you suggested did work for me. I do have a couple additional questions and things to note on the issue.

    Before I updated to the newest version of Xamarin iOS (I just received the prompt to upgrade today) the app would crash completely and throw the above error message. Now that I have updated, I get the same console message that you do. I went back and looked at my other app and it seems that the code was generated the correct way (the way you posted above) but in my new apps (I created three new projects trying to get this work) it did not generate the code in this manner. I don't believe I'm adding the controllers any differently. All I've done this time was add a generic iOS view controller. Any ideas as to how I can avoid this in the future? Perhaps I should have selected a different type of view controller class?

    Thanks!

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @Timothy‌

    I am glad that worked for you. The bad news is I have no idea why it is different than it was. I tried adding every View Controller option in the Add New File dialog and none of the view controllers added that Constructor with the IntPtr, with the exception of the very first view controller class added by default to the project. This was loading a Single View Application template, which includes a storyboard.

    The IntPtr constructor is required when the runtime needs to instantiate the class, which happens when the class is instantiated from a storyboard. When using an .xib, it seems that you instantiate the class and the class loads the .xib, but since a story board has multiple view controllers, it has to happen the other way around. Why load a view controller class until it is needed, right?

    Likely this changed (the IntPtr Constructor not being present by default) as we moved to storyboards as the default for new apps rather than .xib based apps? I would have to consult with the iOS engineers to be certain.

    In the mean time, all I can say is be aware of this issue. I think the best thing we could do is provide a template for a ViewController class that does not include an .xib file and with the IntPtr Constructor and other commonly implemented methods added. If nothing else, this warrants an enhancement request.

    All the best

    Jon

  • pauloortinspauloortins BRMember ✭✭
    edited July 2014

    It worked for me.

Sign In or Register to comment.