9 Replies
      Latest reply on Jun 13, 2019 9:39 PM by KMT
      AncientCoder Level 1 Level 1 (0 points)

        I have a complex iPhone app that I originally created as a Master-Detail (Split View) design, but later changed to "normal" (modal) segue from the Master (initial) view controller to the Detail.  This was because another view controller in the hierarchy also needed to segue to the Detail view, which then caused memory issues beause of the way split-views are implemented.  As far as I can tell,  I changed all necessary code and everything worked fine, with no memory leaks or excessive memory use.

         

        However, with all iOS 12.2 betas on all devices (simulator and physical), using Xcode 10.2 betas, there are hundreds of memory leaks within the app, but mostly in the "Detail" view.  I'm suspicious that there might be some residual code "behind the scenes" that's causing the problems.  The same app under pre iOS 12.2 versions shows no memory leaks: none, zilch, zip.

         

        Has anyone rejigged a split-view controller and if so were there any memory leak issues?

         

        I have filed a bug report, but I'm still wondering if there's a residual issue with the way I made the change.

         

        UPDATE 14 June 2019:  Apple has confirmed that this was a bug, which has been fixed as of iOS 12.4 beta 4 (16G5046d).

         

        Thanks, Michaela

        • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
          KMT Level 9 Level 9 (14,355 points)

          What is the current root controller?

            • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
              AncientCoder Level 1 Level 1 (0 points)

              Thanks KMT, the current root controller is the Master View Controller (within its Navigation Controller). 

                • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
                  KMT Level 9 Level 9 (14,355 points)

                       >current root controller is the Master View Controller (within its Navigation Controller).

                   

                  If it's within a nav controller, it's not root. There are exceptions*, but generally SVC is expected to be root.

                   

                  I used a gen 1 SVC way back when they first came out, that I eventually got creative with, then bandaided for a few years, then something changed and I had to give it up and commit to a legitimate, next gen adaptation. In the process, I learned more about SVCs and to respect what they were doing under the hood, meaning that while they can be your friend, they don't play well when treated casually.

                   

                  See the docs on 'order of containment'* for hints on what you can and can't do with them if you decide to keep one going, but, if you no longer wish to employ an SVC at all, I think you'd be better off to cut/run and get busy with a new app, ground up, foregoing any vestiges of SVC proper.

                   

                  Also, you might want to scan the 12.x beta release notes to see if SVC is mentioned...

                   

                  Good luck.

                   

                  *'Order of Containment': https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html

                   

                  -=-

                  Combined View Controller Interfaces

                  You can use the view controllers that the UIKit framework provides by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. When combining view controllers, however, the order of containment is important; only certain arrangements are valid. The order of containment, from child to parent, is as follows:

                  • Content view controllers, and container view controllers that have flexible bounds (such as the page view controller)
                  • Navigation view controller
                  • Tab bar controller
                  • Split view controller
                    • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
                      AncientCoder Level 1 Level 1 (0 points)

                      Thanks again KMT.  If I made the changes correctly, there is no longer a Split View Controller.  However, your post has prompted me to examine some other possible causes.  Restarting the app from ground up will be very painful.

                       

                      Regards, Michaela

                        • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
                          KMT Level 9 Level 9 (14,355 points)

                          Michaela:

                           

                               > If I made the changes correctly, there is no longer a Split View Controller.

                           

                          That's kind of my point - I don't think there is a good way via -any- changes/tweaks/mods, short of starting over - there can still be stuf under the hood affecting UI logic that can escape attention. Pls. resist getting creative w/Apple's SVC. It took more than one conversation w/DTS before I accepted that SVC was kicking my asterisk and the engr. was right.

                           

                          And yes, I'm familiar w/that particular pain. How's 18 months of re-work on one app sound...in the end, tho, that got me 3 more years in the store, so... The sooner you make that commitment, the sooner that app can get back to being productive. Nothing like restarting an app you believe in to put starch in your digital shorts. You're not in the club until you've bitten that bullet at least once in your dev career

                           

                          On the other hand - your issues may be strictly beta related, in which case, keep testing and hope things right themselves later in the beta cycle.

                           

                          Ken

                  • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
                    AncientCoder Level 1 Level 1 (0 points)

                    Well, it's getting interestinger and interestinger, as Alice would have said peering into her fogged-up mirror.

                     

                    I've just run Instruments (Xcode latest beta) for Leaks in two other, less complex, Swift projects - each with UITableViews and UICollectionsViews.  Neither started out as SVC.  Both showed no leaks running under iOS 12.1.4 on a physical device.  Both showed leaks under 12.2 latest beta:  the simpler app showed a few dozen leaks, the more complex several hundred.  Almost all of the leaks are in Quartzcore or UIKitCore.

                     

                    Methinks there's a more general problem at play here, so my bug report stands.

                    • Re: Change Split View to "normal" segue? iOS (phone) Swift 4.2 and 5
                      KMT Level 9 Level 9 (14,355 points)

                           >UPDATE 14 June 2019:  Apple has confirmed that this was a bug, which has been fixed as of iOS 12.4 beta 4 (16G5046d).

                       

                      Thanks for the followup on the bug (& b4). Let's hope it doesn't make a return

                       

                      Good luck w/your app(s).

                       

                      Ken