October 9, 2015

Xcoders talk: App Transport Security

This past Thursday, I had the opportunity to talk at Seattle Xcoders about App Transport Security. While the talk was mostly a distillation of my previous post on the topic, there were a few new tidbits I learned during research and followup from the original post.

If you’d like to review the slides from the talk, they can be found here; a video is available here. Otherwise, a brief summary of the new tidbits from the talk is as follows.

More
August 21, 2015

Shipping an App with App Transport Security

In iOS 9 and OS X 10.11, Apple introduced App Transport Security (ATS), a low-level set of restrictions on apps’ network connections. One of the most visible of these restrictions is the requirement that apps no longer make connections over plain HTTP; instead, the OS enforces the use of HTTPS unless explicitly told otherwise.

There’s already been lots of great discussion about how ATS works – see, for example, Neglected Potential’s Working with Apple’s App Transport Security. Apple has also provided a descriptive tech note on the feature, clearly documenting the expectations of ATS and the exceptions that remain available to developers. And the community has noted in several articles that turning ATS off entirely is generally a Bad Idea.

This article is aimed at a different purpose: to look at the different speed bumps that can show up while building an app alongside ATS, and to explain how to get around them. There are lots of great little tricks that have only cropped up in OS X release notes or on Stack Overflow, or that can only be discovered by building a sample app. Let’s start by digging into where ATS applies.

More
December 14, 2014

Learning Swift: Convertibles

Note: this post is part of a series about the Swift programming language, introduced at WWDC 2014. I’m no more experienced in Swift than anyone else outside Apple, but I learn best by coding and talking through a problem. If there’s a better way to approach some of these topics, get in touch on Twitter!

As the Swift language matures, most of the standard library has begun to settle into a stable shape. This includes a group of protocols that collectively define convertibles.

Unfortunately, we’re not talking about the cars: a convertible in Swift is, generally speaking, a data type that can be implicitly constructed from a literal. By conforming to one of the protocols in the standard library, your types can provide an extra level of convenience to you or anyone else using your code.

More
December 9, 2014

Objective-C's Designated Secret

For the past several iterations of Xcode, Apple has quietly but steadily improved the quality of the backing toolchain. In particular, the clang static analyzer has gotten quite a few improvements; however, LLVM hasn’t been neglected.

Far from it. In Xcode 5.1, Apple shipped an updated version of LLVM that included upstream revision 196314. The summary of that change is brief – “Introduce attribute objc_designated_initializer” – but the potential implications are wide-ranging. But first: what are they even talking about?

More
December 5, 2014

Objective-C Debugging Cheat Sheet

Over the years, Apple has provided a few handy tricks here and there about debugging Mac and iOS apps. Sometimes, these tricks take the form of private methods implemented by framework classes; if you know the right selector, you can get your objects to dump all kind of debugging information. (Of course, none of these selectors are suitable for use in released apps, but they can prove really handy during the development cycle.)

Since none of these are really documented, though, it’s easy to confuse which private methods are available on which classes. For example: if I have a UIView, should I use -_subtreeDescription or -recursiveDescription to log out its subview hierarchy? And is that really where that underscore goes, or did I get it backwards?

After some nudging from coworkers, I took some time and scraped together all the various private methods I could find (as well as a few suggested on Twitter) and combined them into one debugging cheat sheet, which I’m making available right here. Download it today, and suggest more!

Update: @monowerker put together a Dash version of this cheat sheet, which you can find on GitHub here. Thanks!