Twitter | Search | |
Craig Hockenberry
It’s going to be a busy week for iOS developers - new Xcode, final SDK, and uploads to App Store. But I discovered something important this weekend that you need to check before you ship on iOS 13. If you don’t, you’re going to ship a memory leak to customers…
Reply Retweet Like More
Craig Hockenberry Sep 9
Replying to @chockenberry
The new modal presentation behavior in iOS 13 is something that you probably want to know about in your view controller, right? So you add this code: presentationController?.delegate = self And then implement presentationControllerDidDismiss. Works great! But only on iOS 13.
Reply Retweet Like
Craig Hockenberry Sep 9
Replying to @chockenberry
The UIAdaptivePresentationControllerDelegate is declared weak on iOS 12 - but guess what? It’s not. Adding your view controller as a delegate in viewDidLoad means that controller and view will never deinit because there’s a retain cycle. A leak.
Reply Retweet Like
Craig Hockenberry Sep 9
Replying to @chockenberry
If you’re like me, this is the first time you’ve wanted to be the delegate of the presentation controller, so you’ve never encountered this weak, but strong, bug. That just changed, and you’re not going to see it because you’re focused on iOS 13 testing!
Reply Retweet Like
Craig Hockenberry Sep 9
Replying to @chockenberry
We all know that adoption of iOS is quick - but there will be a non-zero period of time where folks are running your leaky app. So add whatever availability check is appropriate and avoid this issue. This week is going to be a doozy, so here’s no time like the present!
Reply Retweet Like
Craig Hockenberry Sep 9
Replying to @chockenberry
Personally, I was able to avoid the issue by moving cleanup code into deinit (in fact, that’s how I found the issue in the first place, because that code wasn’t getting called.) So it might be a good time to consider what it means for a view controller to be “gone”.
Reply Retweet Like
Craig Hockenberry Sep 12
Replying to @chockenberry
Here’s another heads up about backward compatibility with your iOS 13 update. I’m betting you used named colors if you’re supporting Dark Mode. It’s the only way you can juggle two sets of color and maintain your sanity. If you did, there’s a problem with folks on iOS 11.
Reply Retweet Like
Craig Hockenberry Sep 12
Replying to @chockenberry
Apple has found a problem with named color lookups on the older OS. It’s going to return a nil value in some cases, and that’s either going to: 1) Look like hell 2) Crash your app More info here: (Under “Please note that apps built with Xcode 11”)
Reply Retweet Like
Craig Hockenberry Sep 12
Replying to @chockenberry
In our case, we bumped the deployment target to 12.4 since we had very few users on iOS 11 (use App Analytics to check your own situation.) And why 12.4 instead of 12.0? So we don’t need to include the Swift libraries anymore (smaller download, yay!)
Reply Retweet Like
Craig Hockenberry Sep 12
Replying to @chockenberry
Will we get another Xcode 11 GM seed before the 19th? Who knows, but since Apple is warning developers about this now, it’s best to prepare for the worst.
Reply Retweet Like
jon gary 😷 Sep 9
Replying to @chockenberry
Wait now, who's memory leak?
Reply Retweet Like
Jeff Barbose 🏳️‍🌈 Sep 9
Whoever the customer experiences. For better or worse.
Reply Retweet Like