4 Replies
      Latest reply on Dec 2, 2019 6:56 AM by BarryD0706
      BarryD0706 Level 1 Level 1 (0 points)

        I have developed my first App with iOS 13 as the target. I use a split-view controller and from the "Detail page" of that Split-view, I segue to 4 other ViewControllers ("Present Modally"). The Unwind from these are buttons Cntrl-Dragged to Exit, where I select a function present in the SplitView Controller.

         

        From the "Master page" of the split-view, I segue ("Present Modally") to 3 different Navigation Controllers, each of which contains a "normal" ViewController (embedded just to easily get the top bar). The Unwind from these 3 ViewControllers is done in the same way described above.

         

        All of this works great in iOS 13. Some potential customers asked to support iOS 12 (which I have never developed under). I didn't have to make too many changes to do this, but I seem to have missed something.

         

        The Unwinds from the first four segues continue to work just fine.

        The Unwinds from the last three segues don't work at all. The user is stuck viewing those pages forever. (Yes, on a real device; not just the simulator.)

         

        Looks like there are two differences here: Detail vs Master page as the origin, and the use of Navigation Controllers on the failing cases. Any insights greatly appreciated!

         

            Barry

        • Re: Unwind doesn't work under iOS12
          BarryD0706 Level 1 Level 1 (0 points)

          After stating exactly the scenarios and noting the two differences...

          I removed the Navigation controller from one of the cases, and it still doesn't work.

          It seems that the "problem" is caused by doing the "to" segue from the Detail page of the SplitView.

          • Re: Unwind doesn't work under iOS12
            BarryD0706 Level 1 Level 1 (0 points)

            Here's some info:

            In iOS13, starting the Unwind segue causes a call to "allowedChildrenForUnwinding(from:)" when it is present in the top SplitView Controller. I call the Super of that in my override and the children array contains the ViewController of the Detail page (which is where I really want it to go).

             

            In iOS 12, starting the Unwind segue causes a call to that same routine BUT in the ViewController I'm trying to dismiss! The Super call returns an array with 0 elements. I tried returning the view controller I'm trying to get to and that doesn't make any difference. (The "allowedChildren..." in the top SplitView Controller is never called.

              • Re: Unwind doesn't work under iOS12
                Claude31 Level 8 Level 8 (7,245 points)

                It is difficult to say without code.

                 

                But may be you have a problem with the navigation.

                If you have a navigation, you should have a back button. So why need to exit ?

                 

                ANother possible cause is with fullScreen vs Automatic presentation.

                 

                Could you change, in Attributes inspector, for bot navigationController and its child, presentation to FullScreen instead of automatic and see if you get a problem in iOS 13.

                  • Re: Unwind doesn't work under iOS12
                    BarryD0706 Level 1 Level 1 (0 points)

                    Thanks for your reply Claude. I was using fullScreen already.

                     

                    I finally figured it out. The issue was that, in iOS12, the Unwinds are unwilling to return to the top SplitView Controller when the unwind-from VC was reached from the Primary page of the SplitView. All I had to do was create an unwind-action function in the VC for the Primary page (similar to the one I already had in the top SplitView Controller) and select that new action when I control+dragged the Done button to Exit.

                     

                    This works in both iOS13 and iOS12.

                     

                    (Yes, I probably shouldn't have navigation controllers because I'm not pushing and popping, but as it's turned out, now that I am unwinding to the VC that presented the page, I could be using the navigation controllers functions.)

                     

                        Barry