An Apple iOS Distribution Certificate Dying

In an iPhone developer’s life, there is sometimes mystery around some of the Apple related administrative work that is needed. Certificates expire, Provisioning Profiles have to get regenerated, and test devices come and go.

One interesting question was brought to my attention recently:

If the iOS Distribution Certificate expires, will the iPhone apps in the App Store still work?

Yes. The iPhone apps will still work. From the Apple documentation:

If your Apple Developer Program membership is valid, your existing apps on the App Store will not be affected.

So, it’s well understood that Distribution Certificates expire. What about if someone adds a test device, will that invalidate the iOS Distribution Certificate? The short answer is “no.” Devices are added to Provisioning Profiles as opposed to certificates.

For detailed information, look at the Registering Devices Using Member Center section of the Maintaining Identifiers, Devices, and Profiles Apple documentation and Exporting Your App for Testing (iOS, tvOS, watchOS).

I hope that clears up some of the mystery around an iOS Distribution Certificate dying and point to some helpful Apple documentation.

Mobile Architecture Going Right and Wrong

Most decisions have positive and negative outcomes. When it comes to choosing what technologies to use for a software development team, it often comes down to two different “right” choices. They are right for different reasons and optimize for different things. A smart move is to optimize those things which serve peoples’ best interests (and the interests of their company) even at the expense of other concerns.

Imagine this situation brought to my attention: A team member observes upcoming code duplication between two systems down the road between an iOS and Android product. Among other things, they point out a technological solution that involves adding an additional language that would let them share code between iOS and Android.

From that single point of view, a solution like that sounds OK. Yet, what are the consequences? As you would expect there are pros and cons.


Let’s start with the cons. Adding new things to a technology stack of this kind may cause the following things:

  • Overstressed team by spreading the team too thin
  • Integration overhead
  • Expertise silos
  • Resistance to refactoring
  • Unforeseen issues due to an increase in overall architecture complexity
  • Increased time and pain around troubleshooting
  • Longer time to get new team members up to speed
  • Enjoyment of work going down for some and potentially all

Overstressed Team by Spreading the Team Too Thin

This deserves diving into a little. Imagine the team has recently adopted Android. Let’s say they recently also adopted a new programming paradigm such as Functional Reactive Programming. Now add a couple new team members. What’s the potential result? A magnification of the concerns listed above.


Good things that come can come from adding more to the technology stack:

  • Reduction of duplicate code
  • A new thing to learn (which can be good or bad depending on how much one has to learn currently already)


Which idea is right? Both are right in some ways and painful in other ways. As someone once said:

The hardest decisions in life are not between good and bad or right and wrong, but between two goods or two rights.

Of course decisions need to be made in part against the “-ilities” of architecture. In this case, Architecture complexity increases as one adds technologies. Lessons of the past have taught me that with the adoption of any addition to a technology stack, there can be costs to pay from an architecture and team point of view.

However, consider the people aspect of this too. The quality of a person’s life and their happiness affects productivity. So, measure decisions against those things that will make you excited about working and contributing as well. I highly suggest keeping those in mind. Otherwise, nothing will get done if you are fighting against the human nature of people seeking happiness.

Adventures in Creating iPhone App Store Images

The iPhone app is made and you feel ready to ship. However, you need to get the iPhone app screenshot images into the App Store. When you work at a great place like CARFAX, there are other awesome people who do that quite well.

When doing it on your own, it’s no small feat to make and upload images for your iPhone app that are decent. Sure, one can just grab a screen shot of the app and shove it up there. However, high quality images that evoke an emotional response and reveal interesting parts of your app are best.

Some questions came to mind while I was going through this process:

  • How to create a screen shot of the iPhone app without the status bar?
  • How to have the screenshots look fancy like the Clear or CARFAX mobile apps?

By fancy, I mean have the screenshot surrounded by an iPhone image that is appealing.

Possible Solutions

Let’s quickly go over some possibilities I first ran across. At first glance, looked promising. Searching on was another possibility. If all else failed, I was going to back to the Ray Wenderlich tutorial to dig up another answer. had real promise. I found out about it from the Ray Wenderlich tutorial. has lots of variety in their images. After playing around with it for a long time, I found an image I liked but it didn’t seem like a drop in solution for use in the App Store. Since the variety is fantastic, I may go back to it later for some of my website marketing. For app images though, I eventually decided to start out with something simpler.

This site has a simple and easy to use interface. I like how they have things set up so that you can use PayPal and codes to get your purchase. After playing around, I came up with an image I like. So how many images do I need? Five images for four phone sizes came to twenty images. Each image would cost a few dollars. Hmm. Can one do better?

Ray Wunderlich Tutorial

The tutorial title is How to Make Great App Store Screenshots. It’s a good tutorial. It introduced me to several different options. The last time I saw this tutorial I skipped down pretty quickly to the Photoshop solution so I hadn’t deeply checked out the other options.

Random Thoughts

While going through the tutorial and seeing how much time I spent on all of this, I started having some random thoughts. Thoughts like:

  • Why is this taking so much time?
  • There’s clearly a market for iPhone pictures for the app store.
  • Why do I see typos wherever I look? For example, Screenshot Maker Pro has some serious grammar errors here.

After I got over the typos, I saw that Screenshot Maker Pro looked promising.

Screenshot Maker Pro

I had my doubts due to the typos and from what I saw on the webpage. However, trying out the app had increased my confidence in the solution. After taking a screenshot, making an image, and playing with the settings, I found something I like. However, it’s the wrong size and transparency is on. Apple doesn’t like App Store pictures with the transparency on.


So, into an image editor I go. I tried various things including a command line tool called sips.  However, I finally landed on using Acorn. It only cost me about $30. My goal was to just make a 4.7 inch portrait image that’s 750 wide x 1334 tall or vice versa for landscape. After some messing around, I got something that worked. I had to resize the image and then the canvas. I also figured out how to turn off the transparency aka alpha by using the Preview app.

With this new found knowledge, I did the other sizes. For the iPhone 4S, Screenshot Maker Pro didn’t quite work. So, I just uploaded the screenshots themselves. Sometimes you have to know when to say when and move on.

Specific Example For an Image That I Wanted as Landscape:

  • While preserving aspect ratio, I resized the image to a height of 750 pixels. The width ended up being 1089 pixels.
  • I resized the canvas width to the needed 1334 pixels

Time to get rid of the transparency. I turned off the alpha using Mac Preview’s export to PNG with the alpha unchecked.

Image Concerns

  • One of my images showed off the notification that the app sends. However, it also showed the home screen. That violates the following guideline: “Never display the Apple Watch, iPad, iPhone, iPod touch, or Apple TV Home screen or any icon or image that you do not own.” I deleted that image.
  • Looking at my other images, another concern arose. The status bar showed a specific carrier, AT&T.

To hide the status bar for App Store sakes, I found this from a Stack Overflow post:

With that I could temporarily hide the status bar while taking the screen shots. So, I redid all the images.

Acorn Again

Now with the concerns are out of the way, it’s time to reuse Acorn and fix the newly created portrait images with Acorn:

  • Resize image height to 1334 (forces width of 583 to keep same aspect ratio)
  • Resize canvas to 750 width
  • Open in Preview, export as PNG, uncheck “Alpha”

Images Loaded

I loaded the images into iTunes connect. It complained about one of the images, but logging out and logging back in let me put the last image into place.

Now What?

Next step, I need a website. While figuring out how to get a starter webpage up quickly that doesn’t totally stink, Freddy A. Montas mentioned LaunchKit. Glancing at a related TechCrunch article, it seems like LaunchKit might take care of what I need and maybe even the App Store screenshots I just did. So, all of the above might not be needed in the future. That’s OK. I learned a lot and that won’t be my last release into the App Store.

Good luck with your app submission and marketing adventures!

Disclosure: I work for CARFAX as an iOS Software Developer.

Update April 2019: Apple Screenshot specifications require an upload of 6.5-inch screenshots. That means the iPhone XS Max. However, Screenshot Maker Pro does not support iPhone XS Max. This will not do. I am hoping that reading Save time and increase your apps conversion rate serves well.

RxSwift Moved Swiftly from 1.9 to 2.1

RxSwift 2.1.0 is out! Congrats to kzaher and all the members.

Since things moved fast over the winter holidays in RxSwift, you might see some changes that happened between 2.0.0-beta.4 and 2.0.0 that interest you if you haven’t switched yet. When moving from the latest RxSwift beta to 2.0.0, the 2.0.0-rc.0’s Deprecated section of the Change Log may answer some compilation issues you face.

Straightforward changes were needed for my work. For example, I needed to stick Observable in front of create. As covered in the Change Log:

Deprecates free functions in favor of Observable factory methods

An interesting one involves Variable:

Deprecates Variable implementing ObservableType in favor of asObservable()

Looking at GitHubSignup “UsingVanillaObservables > 1″ and “UsingDriver > 2″ in the RxExample code, I see the answer to my questions and so much more. There is an emphasis on using Driver as opposed to Variable objects. Although, a deep dive into Driver is a whole other topic.

In regards to 2.1, the changes from 2.0 to 2.1 are minimal and had no impact on my work.

Enjoy the new stuff!

Swift structs, closures and Memory Leaks

Using structs and registering closures with a framework? Did you know closures are reference types?

If your closure is registered with a class from a framework and the closure is closing over self then you have a strong reference cycle memory issue. For example, let’s say we have a struct which has an RxSwift class Variable<String> member called someVariable.

When you give the subscribeNext the closure, it will store that closure into the framework. In other words, it has a reference to the closure. If you are referring to self in that closure, you have a strong reference cycle. The struct has a Variable which has a closure that has a reference back to the struct.

Can we just make the self reference a weak reference? No. Not if it’s a struct.

If it’s a class, we can do the following:

Note that we are using class and [weak self] now. We also took away the mutating from before the function.

That solves the memory issue! Thanks goes to some helpful humans which include Darren and Marc Khadpe in this Stackoverflow post.

Update: For an example such as this, Carlos García rightfully pointed out that using [unowned self] would be better. It’s faster and more. Carlos pointed out this article: How Swift Implements Unowned and Weak References and a related Twitter thread.

If you are going to use unowned, you will want to know when your app can crash when using it.  “Weak, Strong, Unowned, Oh My!” – A Guide to References in Swift is a good guide for when to use weak, unowned, and the default strong references.

Swift Protocols With Associated Types – PATs

What first led me into understanding Protocols With Associated Types (PATs)? Answer: RxSwift. It’s an awesome FRP framework for Swift.

What led me to the protocol compilation error “..can only be used as a generic constraint” which looks like this?

1PAT with compiler error

(Source: Alexis Gallagher – Protocols with Associated Types – 1:24)

Answer: Applying BDD (Behavior-Driven Development) to our Protocol Oriented MVVM RxSwift empowered code and using dependency injection.

We were going to use structs and protocols wherever we could. However, we had to back off some. Thanks to Alexis Gallagher, it’s clear now why we ran into the same problem that he presented in his video presentation, Protocols with Associated Types and how they got that way (maybe). Here’s a problem example he shows:

2PAT single variable declaration

(Same source: 2:47)

This great presentation was part of the 2015 Functional Swift Conference. The Protocols with Associated Types, and How They Got That Way slides are available. However, I highly recommend listening to the whole presentation. Since it’s 56 minutes long, this blog post links to certain key parts of it with associated snapshot images just to give you a taste of what is in there.

From this presentation, there are some crucial key takeaways:

  • Can’t use dynamic dispatch with PATs
  • typealias can do two very different things
  • There are workarounds if you need to do dynamic dispatch

Can’t Use Dynamic Dispatch With PATs

The compilation error “..can only be used as a generic constraint” described above shows how PATs are unique and different from plain old Protocols. The following dives into the ramifications of this situation:

3No Dynamic dispatch

(Same source: 6:54)

PATs are their own thing. As Alexis G. says, call them PATs and recognize how they are different.

typealias Can Do Two Very Different Things

4typealias two different uses

(Same source: 11:39)

As specified in the Swift Language Reference on Declarations, you can use typealias to:

  • Create a name for a type. See the “Type Alias Declaration” section.
  • Require something that conforms to a PAT, to specify a type. See the “Protocol Associated Type Declaration” section

Slide 18 of his presentation has a good example of showing typealias being used in a PAT.

There Are Workarounds If You need to do Dynamic Dispatch


(Same source: 39:08)

Workarounds are:

  • Enums
  • Type Erasure

The future looks bright if they add Existentials to the language. There is a Stackoverflow post about the generic concept an Existential Type.


Until they add Existential Types to the Swift language, we should fully understand PATs and how to use other parts of the Swift language to accomplish what we want.

As an aside: If you got this far, you really may want to watch the whole presentation on youtube. This blog post was made to just catch some of the interesting bits for later referral. Enjoy!

RxSwift Driver – What is it?

Curiosity is a powerful thing. When I saw this RxSwift Driver being discussed on RxSwift Slack and read the helpful RxSwift GitHub issue “Need better explanation / examples for Driver” submitted by Florent Pillet, it seemed helpful to capture what I saw.

As Carlos García shared on the GitHub issue:

One should think of the following:

as the same as:

Krunoslav Zaher aka kzaher on the RxSwift slack community said that it is a combination of: “main thread + shared subscriptions + no errors.” He goes on to say that shareReplay(1) is a shared subscriptions example. Carlos adds there are several examples in RxExample.

kzaher sums it all up nicely by sharing:

Yeah, it’s just a tiny builder/dsl for Observables. I think this should help me and others a lot with ensuring you can safely bind values to UI.

Using Driver is optional, but it helps the compiler catch things and will help emphasize things that might have been missed. As kzaher put it:

..and warn me when I’ve forgot to handle unexpected errors, or binding from background thread or doing something I should have when dealing with UI applications.

You may want to keep an eye on the RxSwift documentation as it grows and develops over time. Specifically, this Units document. Driver sounds exciting and I look forward to trying it in-depth in the near future!

Jan 2, 2016 Update: The Units document has been updated and much more has been added to it. Good stuff!

RxSwift Glossary and Concepts

Do you speak RxSwift? Do you know the concepts, words and operators? Here is a snapshot summary of many of them.

Some of the RxSwift Concepts from Getting Started

An Observable is a definition of: 

  • “ the sequence is generated..”
  • “..what parameters are used for element generation..”


“..release all of the resources that were allocated to compute upcoming elements..”

Observable aka Sequence

  • One after another, the Observable sends a Next (element), Error, or a Completed
  • What stops them from coming? An Error, Completed or dispose the subscriptions.


Subscribes to Observables


(Source: Rx.playground)

Terse mode: “acts both as an Observer and as an Observable”

Full mode: “A Subject is a sort of bridge or proxy that is available in some implementations of ReactiveX that acts both as an observer and as an Observable. Because it is an observer, it can subscribe to one or more Observables, and because it is an Observable, it can pass through the items it observes by reemitting them, and it can also emit new items.”


There is a list sorted by functionality at

Operator Types:

(Sources: Rx.playground and github docs)

  • Combination operators – startWithcombineLatestmergeswitchLatestzip; “Operators that work with multiple source Observables to create a single Observable”
  • Conditional and Boolean Operators – takeUntiltakeWhile – “Operators that evaluate one or more Observables or items emitted by Observables.”
  • Connectable Observable Operators – multicastreplay, replayAll, publish – “like an ordinary Observable yet only when its connect() is called does it emit”
  • Error Handling Operators- catchErrorretry – “Operators that help to recover from error notifications from an Observable.”
  • Filtering Observables – distinctUntilChanged, filtertake; “Operators that selectively emit items from a source Observable.”
  • Mathematical and Aggregate Operators – concat, reduce – “Operators that operate on the entire sequence of items emitted by an Observable”
  • Observable Utility Operators – doOn, subscribesubscribeNextsubscribeCompletedsubscribeError; “toolbox of useful Operators for working with Observables”
  • Transforming Observables – map / selectflatMapscan; “Operators that transform items that are emitted by an Observable”
  • Units – “purpose of Driver unit is to ensure the underlying observable sequence has the following properties”: It “can’t fail”, “main thread”, and more.


Schedulers are an abstraction away from what does work (queues / threads).


By the way, the RxSwiftCommunity bears checking in on from time to time. Action is listed there and it comes up often in the RxSwift Slack community and at least once in Stack Overflow. Just like the adoption of RxSwift, I sense the community will grow over time.

Update: If one looks at the code commits done for the RxSwiftCommunity website, one can easily see lots of activity going on.

RxSwift and Memory

Tom Burns asked a good question about TableView bindings outliving the view controller. As he said:

I’m asking because I noticed that some of my tableview bindings were outliving the view controller being popped back off the stack and it seemed like unnecessary work was being done…

kzaher of the RxSwift Slack community pointed out the following code as being the culprit:

Tom fixed the code to use an “[unowned self]” before the newObjects. Such as:

Although such memory situations aren’t limited to RxSwift, using RxSwift might encourage such situations to come up more often. It something to watch out for.

Regardless, this is something we all can run into from time to time. I feel fortunate enough to have caught the conversation in the RxSwift Slack community and am grateful to Tom for asking.

Simpler RxSwift Test Code

Looking at some RxSwift test code, I knew it could be better. As I shared with Krunoslav Zaher aka kzaher in the RxSwift Slack community:

I feel the opportunity for improvement down to my soul.

Test Code
He kindly helped me simplify some RxSwift test code. He suggested that instead of:

Do something like this:

To make that work, I had to change the oldBakeryServiceSpy from something like this:

To this:

This also allowed us to use failWith. As in:


More kzaher Words of Wisdom

if you are mocking, just use just, sequenceOf, [].toObservable()

It was also shared that TestScheduler will be released soon and one can look at the unit tests.

What about Simplifying Our Use of the DisposeBag?

As a result of what we read in the README, we use DisposeBag objects often. As kzaher shared:

If you use operators, that will reduce the amount of dispose bags significantly. We handle all of disposing for you. You only dispose terminal endpoints where you do “subscribe”

All Part of the Game of Learning

Slowly things are improving. Although it’s all part of the game of learning something new, I think it would serve all well if someone created a game called “Simplify This RxSwift code.” I know I would happily play it.