For version 1.2 of the Mixologist Sticker Pack, I wanted to do more than just add a few more new drinks. Taking a lesson from my friend Curtis Herbert, I wanted to add something to the app that improved it as a business. In this case, I wanted a link to my other sticker pack, the Leo Collection, inside the Mixologist.
Seems like a no-brainer to let the customers of one of my sticker packs know about my other packs, right? After all, these are people who have demonstrated that they know about, like, and will pay for stickers. They are a perfect target demographic.
Adding a link to the App Store inside an iMessage extension is trickier than it sounds, though. This is because extensions in iOS don’t get direct access to openURL. So you can’t simply add a link button that will launch the App Store app.
So how do I link to the Leo Collection from within the Mixologist? That took a bit of asking around to my developer friends. I knew it was possible, thanks to the many great sticker packs offered by Iconfactory. At the bottom of each of their packs, there’s a button that launches a new view with all their packs listed. Tap on one, and you get an App Store page, complete with a Buy button, right within the extension. Nice.
So how are they doing this? I asked a few friends (Sam Gross and Jeff Grossman) while attending CocoaLove last week in Philly, and as people in our community tend to do, they immediately started brainstorming. Within thirty seconds, one of them suggested SKStoreProductViewController.
If you’re wondering, “What the heck is a SKStoreProductViewController,” don’t worry. I hadn’t heard of it before, either.
Turns out, as of iOS 6, StoreKit includes a controller that will only show you a specific App Store product page, right within your app. No need to link out to the App Store app. No need to bring up a Safari View Controller. It’s a nice tool that I had completely overlooked previously.
And best of all, it works within an iMessage extension.
Initialize the view controller with your product id (and even your affiliate token, if you like) and you can bring up the page for any product you want.
I went home after CocoaLove and tried it. Sure enough, that was how Iconfactory was pulling off this trick.
One small downside to the SKStoreProductViewController: It’s no good for prompting the user for reviews. I wanted to have a “Leave a Review” button on the same page that launched a SKStoreProductViewController with Mixologist as the product. But it turns out that not only can you not initialize the view on the Reviews tab automatically; even if the user goes to that tab and taps the “Write a Review” button, nothing will happen.
Still, I managed to get a link to the Leo Collection into the Mixologist pack. It’s unobtrusive, sitting way down at the bottom of the collection, so as to not get in anyone’s way. But it’s there, if one of my customers is curious.
Now I just have to put a link to Mixologist Sticker Pack inside the Leo Collection.
If you have more than one sticker pack, I suggest giving this a try. It doesn’t take long to get the controller up and running, and the potential benefit is well worth it.
Update: Daniel Farrelly (@jellybeansoup) informs me that you can use openURL in an extension, as long as it’s on the extensionContext. I still prefer using the SKStoreProductViewController to keep my user inside my extension and not bounce them out to the App Store. But I may look into this as a way to make a Leave a Review button work.
Don’t worry. I also added three new drinks. Port wine, the Kir Royale (as requested by Jean MacDonald) and the French 75. ↩
My guess is Apple doesn’t want people getting bounced out of Messages unexpectedly from an extension. There are probably also security concerns. ↩
I recommend doing what Iconfactory does, and forcing your extension to the expanded size when you load one of these views. ↩
The button is there. It looks active. But when you tap it, nothing happens. No error message. No indication that something is wrong. Just nothing. Poking around, it seems that Apple wants it this way, for some reason. The button used to work, but stopped a few major versions of iOS ago. Radars have been open on it for years. But all indications are that it was disabled intentionally by Apple. It’s a shame, really. It would be nice to make it just a bit more convenient for users to leave a review. ↩
Maybe it’s too well hidden, in fact. I figured it best to err on the side of subtlety, rather than hitting people over the head with it. Time will tell if I should do something to make the button stand out a bit better. ↩