State preservation and restoration allows iOS apps to save state when they’re sent into the background, and restore that state if the app is killed and then relaunched. If you’ve ever implemented state restoration yourself, you may have run into a case where it’d be helpful to see exactly what state iOS was storing.
It turns out that Apple actually provides a tool to help you do just this, but it’s kind of hidden away and documentation is relatively sparse. Fortunately, it’s pretty easy to use. When you run it, it’ll output a structured plist showing all of your encoded objects, their restoration identifiers, and restoration class information. Here’s a step by step guide.
My first impressions of Nintendo’s latest console and its flagship game.
It’s hard to separate the Nintendo Switch and The Legend of Zelda: Breath of the Wild when considering their relative merits. The two were released on the same day, and for most people the Switch is ‘just’ going to be a Zelda machine for some time due to its meagre launch lineup.
And that’s fine.
I originally preordered the Switch as soon as preorders were available, but ended up cancelling it shortly before the Switch’s launch. I was bitten 5 years ago by the 3DS – there were almost no games worth playing at launch, and then the system received a price cut of about 1/3rd just 4 months after it was released. Fool me once…
But then the Zelda reviews rolled in. Everyone who’d got a Switch already seemed to love the console, and Zelda was getting almost universal praise. Despite the Switch being sold out everywhere I managed to catch them in stock for a very short period at Nintendo UK, put in my order, and it arrived the next day. So how is it?
In my opinion, the Switch is the best hardware Nintendo has produced in 10 years, since the original Wii and the DS Lite. For the most part, it’s really well built and the design is minimal and unfussy. It’s nice and compact, but the screen and controllers are just about big enough. The tablet is also reasonably light and reasonably thin (here’s a comparison to the iPad and iPhone, if you’re interested).
The 720p screen is high quality, and in a first for Nintendo it uses capacitative touch instead of resistive touch. It feels much more modern than the 3DS and the Wii U, both of which had terribly low resolution screens with large gaps between the display and the ‘glass’. It’s the first time I’ve been really impressed with a Nintendo display in a long time (or perhaps ever?).
The system software also feels much more modern than anything Nintendo have put out before. It’s got a very nice clean UI, without any of the ‘chintz’ that I typically expect from them – pinstripes, bubbley 3D buttons and the like. It’s also nice and fast, and feels like it’s actually capable of handling several tasks at once. The 3DS and Wii’s software always felt very modal to me; you had to stop one thing to do another. It certainly feels like a version 1.0 though, and I’m excited what Nintendo add to it in the future.
I think my favourite part of the whole system is its flexibility, which is of course the main selling point of the whole system. You can dock it and play on your big TV, or pick it up, slide in the controllers and play it handheld. Or you can prop it up, slide out the controllers and play it in ‘tabletop’ mode. Or stick the controllers into a grip and use them in a more traditional configuration. I’ve found myself switching between all the different modes and it feels great in each. It’s also really easy to switch between them.
The Joy-Con controllers feel nice in the hand, but can be a little fiddly. The shoulder buttons in particular are quite small and close together, and if you’re not using the controllers in a grip it can be hard to switch your fingers between them – there’s not quite enough to hold on to. That said, I do really like them (the neon coloured versions are amazingly bright – photos don’t do them justice), and the Switch’s flexibility means you can use them however is most comfortable to you: in a grip, held individually, attached to the Switch itself… There is also a ‘Pro’ controller available, which I haven’t tested myself but I’ve heard good things about.
I also think it’s utter genius that each console effectively comes with two controllers. When Mario Kart launches, you’ll be able to play two player local multiplayer right out of the box.
We only have one TV in our house, so I often find myself playing my PS4 via the PS4 Remote Play app on my laptop if my wife is watching TV. It works well enough, but of course a lot of visual fidelity is lost due to video compression when streaming. The Switch, then, is the perfect fit for me as it’s designed around this exact use case. The visuals are excellent when playing handheld. In fact, Zelda actually seems to perform better in handheld mode, with fewer frame rate drops but no noticeable difference in quality.
The only piece of Switch hardware that feels lesser quality to me is the TV dock, which is a bit of a disappointment. It’s a lightweight, slightly flimsy-feeling block of plastic, although I do like the glossy Switch logo on the side of it. The Joy-Con controllers are so satisfying to slide onto the Switch itself – they snap into place with a pronounced click, which is mirrored by a visual effect on the screen and a sound played by the system software.
The dock has no such satisfaction. There’s nothing to really guide the Switch into the right place and it just spongily makes contact with the bottom of the dock with a bit of a bounce. It never really feels like it’s in there properly. I wonder if Nintendo will improve this with future revisions.
Whilst reading my first draft of this post, I realized I forgot to mention the battery life of the Switch. That’s because so far it’s never been an issue for me. It’s far better than I was expecting, and I’ve never found myself running out of battery when I want to keep playing.
Finally, modern hardware and software from Nintendo that feels competitive with smartphones / tablets and other consoles.
Great feeling hardware (tablet and controllers) with excellent build quality.
Flexibility of play styles, which is easy to do and very well executed.
Battery is better than I was expecting.
Dock feels flimsy and is awkward to use.
Very few games so far. But Mario Kart, Splatoon, and Mario Odyssey are coming. Also, Zelda.
The Legend of Zelda: Breath of the Wild
Zelda is the Switch’s flagship game, and by all accounts is a real system seller. And with good reason. It’s excellent.
It feels like a Zelda game, but it’s also completely different from any other Zelda game. Pretty much from the get-go, you can go anywhere, tackle anything in any order you want, and there’s no hand-holding. The world is big. You won’t believe just how vastly hugely mindbogglingly big it is. There’s always somewhere new to explore, or some side quest to get lost in. The world also has a really interesting physics engine behind it all, which opens up all sorts of possibilities for combining different items. Shoot an arrow through a campfire into a tree and the whole thing will go up in flames. The joy is in the emergent gameplay that crops up through these interactions.
The game’s openness works really well with the Switch’s flexibility and portability. The system sleeps and wakes instantly, so you can carry this vast world around with you and drop in and out whenever you like. And if you feel like it, you can play it on the big screen too. I can see myself dipping into this world for many months (or years) to come.
I will say that whilst I am absolutely loving the game, I don’t think I agree with all of the 10/10 scores it’s been receiving. It’s definitely a 9/10 and probably even a 9.5/10, but I think it’s slightly let down by a couple of issues. It’s technically impressive what Nintendo manage to pump out of this small portable device but after just finishing Horizon: Zero Dawn on the PS4, with its lush, richly detailed landscapes Zelda feels a little lacking in places. For example I’ve come across mountain peaks with very low model and texture details: smooth domes with quite low resolution textures smeared across them and no extra set dressing. It’s perhaps a little unfair to compare the two games, but it doesn’t stand up to Zero Dawn‘s incredible world.
Objects also pop in and out of existence at a little closer distance than I’d like. You’re able to get a telescope-style zoomed view to look at the landscape around you, but it’s hard to scope things out when any enemies that may be in the distance don’t get rendered. You’ll also occasionally see super low-polygon versions of structures that are a long way off. The world is certainly beautiful, and moments regularly crop up that make me just stop in my tracks to admire the scenery. It’s just that these technical issues occasionally do crop up and break the spell:
I’m not going to say too much more, because I think the fun in Breath of the Wild is all in discovering things for yourself. If you like Zelda games you definitely need to play it. If you haven’t played them before, you should definitely give it a go.
The perfect game for the Switch. Dive in and out whenever and wherever you like.
An incredible, vast world filled with things to see and do and play with.
An exciting new direction for the Zelda series.
Combat is fun and satisfying. There are also many, many ways to tackle different encounters with enemies thanks to the physics system.
Technical issues do let the game down in places. It’s not too often, but sometimes breaks the immersion.
Voice acting is very hit and miss, and the dialogue is pretty poor.
I’m really pleased with the Switch. The hardware is pretty perfect for a first revision. It’s very well built and well designed. Nintendo have finally produced hardware and software that stands up there with modern mobile devices, and it’s exciting to see where they’re going to take it. Having one device that works seamlessly from your living room to anywhere-else-you-want-to-use-it feels exciting and new, and it works exactly as it’s supposed to.
Zelda, too, feels like something new and is the perfect accompaniment to the Switch.
I really hope the Switch is as successful as Nintendo need it to be, and that they (and third parties) continue to support it with great games.
Ever since I first tried VR, I knew I had to own a headset. I finally do, and I’m really pleased with it.
I was more excited leading up to the release of the PlayStation VR than I remember being for any other recent tech product launch. Mine arrived last week and a lot of people have asked me what it’s like, so I figured I’d write up my thoughts.
The headset itself is really comfortable. The design, build quality, and materials that Sony have used are excellent. The inner padding of the headset is a really nice textured rubber, and it feels great and looks very premium.
The headset is also very easy to put on. No awkward velcro straps like the Vive or Rift. There’s just a sturdy band that fits around your head, and a small dial to turn to tighten it once it’s on. Once it’s in the right place you can slide the actual visor (containing the screen) forward and backward, so you can move it closer to your face and find the ‘sweet spot’ where it’s in focus. Whereas the Vive and Rift screens are pulled tight against your face like a pair of ski goggles, the PSVR comfortably hangs in front of your eyes.
And it works really well with glasses! Sony paid particular consideration to users with glasses, and for me at least it’s very comfortable. Whenever I’ve used a Vive or a Rift in the past, I’d have to put it on in an awkward way to fit around my glasses, and they’d get stuck inside it when I took it off.
There’s a small amount of ‘light leak’ at the bottom of the headset, where you can see the real world if you look down. Apparently this was an intentional design on Sony’s part, to allow people to ‘ground’ themselves if necessary. I have to say that once I’m playing a game, I don’t notice it at all.
Setup was very easy, despite there being quite few cables involved. The cable from the headset to the processor unit1 felt to me to be much thinner and less intrusive than either the Vive or the Rift’s cables. It also contains a useful little inline remote into which you can connect a pair of wired headphones (which receive full 3D audio). The remote allows you to change the volume, turn the headset on and off, and mute or unmute the headset’s microphone.
I’m impressed by the quality of the PSVR’s display. The colours are great, it’s bright, and there’s little to no screen door effect2. It’s not the highest resolution (it’s marginally lower than the Vive and the Rift), but I can live with that as it’s just a reality of where VR tech currently is.
It also seems like it’s the games that are mainly letting things down on the resolution front – in a game that’s rendering at a resolution higher than that of the panel (‘supersampling’), such as Job Simulator which runs at 1.4x resolution, things look quite sharp. Other games are clearly running at a lower resolution in order to get the required performance, and it shows. EVE: Valkyrie in particular gets very blurred at a distance, and whilst I haven’t played it I’ve heard that Drive Club has big resolution issues. I think the PS Pro should help in this regard, as it’ll allow games to render at higher resolutions.
The only other issue I have with the screen would be that it has a fairly prominent ‘mura effect’ in dark scenes. This is where you can see a random pattern of slightly lighter coloured pixels across the screen. It essentially means that dark / black scenes aren’t truly black, and instead are like looking at a dark grey textured pattern which moves with your head. It’s not awful, and it’s easy to look past, but it’s there.
If you’ve never experienced VR for yourself, it’s difficult to convey what it’s like. Not only does the game surround you everywhere you look, but the sense of depth and scale is incredible. It’s like nothing else. The head tracking on the PSVR generally works really well; the framerate is excellent, and the gameplay very smoothly follows your head movement.
Head tracking in general works well, and rotational tracking (tilting your head to look in different directions) is certainly spot-on. I’ve had a few small issues with positional tracking (your 3D positioning in the world, as you move forward / backward / left right) in some games and when sat further away from the camera. In particular, in the demo of Job Simulator, the environment around me continually moves forward and back slightly whilst I’m stood still, which can result in you feeling a little weird / drunk.
Both headset and controller tracking3 rely on the PlayStation Camera (required for PSVR, but not included with the headset) tracking the visible light from their bright LED strips. Occasionally the controllers also suffer from some ‘jitter’, and if their LEDs aren’t visible to the camera they can disappear in games entirely. For the most part it works well enough, although one can certainly question Sony’s decision to base fairly critical parts of PSVR on slightly flaky 6 year old technology (although presumably cost was a big factor). Having used both the Oculus Rift and HTC Vive, I can say that both of their tracking systems are rock solid in comparison.
The tracking is my only real complaint about the whole experience, and it’s not enough to put me off PSVR or rely detract from gameplay at all. Most of the time it’s fine, and I think as a more technical user I’ve actively been analysing how well things perform and looking for problems. Most people probably won’t even notice.
Ever since I first tried VR, I knew I had to own a headset. I finally do, and I’m really pleased with it.
Sony have done a good job of delivering convincing, immersive VR at a much lower price than either the Vive or the Rift. And that’s just the cost of the headset – I also don’t need to buy or maintain an expensive PC, which is a huge plus for me. Whilst the visuals may take a bit of a downgrade, and the tracking isn’t as good, it’s plenty good enough to fool your brain4 and there are some fantastic games and ‘experiences’ available.
In fact, I think one of PSVR’s stand out features (besides cost and easy of use) is that it has a great lineup of launch titles. In the next post, I’ll give a brief opinion on each of the games I’ve tried so far.
A small box that connects to your PS4, which handles splitting the HDMI signal to the TV, 3D audio, and the PSVR’s ‘cinematic mode’. ↩
Screen door effect is where you can see black lines between the pixels of a VR headset (hence it’s like looking through a fine mesh / screen door). Apparently the PSVR largely avoids this due to having full RGB subpixels, although I don’t really understand the technicalities of it. ↩
The standard Dual Shock 4 and the PlayStation Move controllers can be used in various games, and they often have a virtual representation in the game. ↩
I’ve not suffered from any motion sickness from PSVR (although many people do get it from certain VR experiences), but it’s triggered my fear of heights many times. Whilst I know there’s no danger – I’m sat in my living room, after all – the experience is convincing enough for my brain to momentarily go AAAAAARRGGH. It’s kind of fun though. My favourite is currently in RIGS, where you get launched 60 foot into the air out of your RIG whenever it explodes. ↩
A collection of some of the smaller Xcode, iOS, and watchOS changes I’ve come across whilst reading Apple’s updated developer documentation during WWDC.
There were some nice announcements from Apple at WWDC yesterday, including a revamped lock screen and notifications for iOS, SiriKit, and a lot of iMessage integration. Whilst scouring the newly-released developer documentation I’ve come across a lot of interesting tidbits that aren’t headline features on their own, so I thought I’d collect them here in case they’re of use to anyone else. In no particular order:
Some nice improvements to Interface Builder. You can now edit your UI at any zoom level (FINALLY)! The UI for customizing layouts for different device traits has also been revamped, and looks really good.
Image and colour literals are now supported in Swift code, including code completion for images that’re in your asset catalog. Simply start typing either color or UIImage.
There’s a new monospaced code font in Xcode: SF Mono that seems to match up with the WWDC promo material this year.
The simulator features a special version of the Messages app which allows you to see both halves of a conversation between two users. Very useful for testing all the iMessage newness.
Xcode 8 supports both Swift 2.3 and Swift 3. If you choose Swift 2.3 for a project, there’s a new build setting that gets set to Yes: “Use Legacy Swift Language Version”.
The new memory debugger looks incredible. You can visualize the current object graph, and it can help identify memory leaks / retain cycles.
Xcode now highlights the active line when editing.
There’s now NSDateInterval for counting the duration of a time interval, checking whether a date exists in a range, and comparing intervals.
The User Notifications UI framework lets you customize the appearance of local and remote notifications when they appear on the user’s device.
You can also intercept push notifications (through UserNotifications.framework) and handle them before they alert the user. For example, you could download a video and then tell the user it’s ready.
Rich notifications are currently only optimized for 3D Touch, and they’ll be providing access to functionality for users of other iPhone models / iPad at a later date.
A lot of the existing remote and local notification methods on UIApplication (as well as UILocalNotification itself) are now deprecated in favour of the UserNotifications framework.
There’s a load of new animation APIs: “New object-based, fully interactive and interruptible animation support that lets you retain control of your animations and link them with gesture-based interactions.”
The refresh control is now supported in all scroll views and scrollview subclasses thanks to UIRefreshControlHosting.
There are new UIVisualEffectView blur types: prominent and regular.
NSPersistentContainer looks like it might replace the simple CoreDataStack class I’d add to most new projects. It encapsulates the whole core data stack, and has convenience methods for creating new background contexts and performing background tasks.
NSManagedObject gets a few new methods – init(context:), fetchRequest(), entity().
Xcode should be able to automatically generate classes for Core Data entities, but I’ve been unable to get this to work so far.
Okay, so we’re already a month into 2016, but I’ve been a bit busy. 🙂
At the end of November, I left my job of 3+ years as a senior iOS developer at Mubaloo to join Automattic as a Mobile Wrangler.
In case you haven’t heard of them, Automattic is most well known for WordPress.com. They’re also responsible for Simplenote, a simple note storage service which I’ve used since the early days of the iOS App Store.
Automattic is an incredible company to be part of. Their mission is to democratise publishing, providing a platform for anybody to have a blog or website. The entire company is distributed across the world, with employees in 43 countries. Pretty much everybody works from their own homes (although if you want to work from a coffee shop or a coworking space, that’s cool too) and sets their own schedules. With a 1 year old son at home, I’m so grateful that I’m now at home all day; I get to see him so much more than I used to, we can all have lunch together, and I can work a schedule that suits my family.
I’ve also converted this site (which hasn’t received much love recently) over to WordPress, and I hope to begin writing here again soon.
At Automattic, you actually choose your own job title. Mobile Wrangler is what most of the mobile developers go by, although there’s definitely a Pokémon Trainer amongst the ranks too. ↩
When writing code, I generally like to use a dark theme in my IDE or text editor. For Xcode, I really like the Tomorrow Night and Seti themes in particular (both of which can be easily installed using the Alcatraz package manager).
In Xcode, however, there’s a slight problem for dark theme fans:
By default the ‘i-beam’ mouse cursor in the editor is really hard to see, particularly on a high resolution monitor. I’d often find myself losing it and having to shake the mouse to activate El Capitan’s mouse zoom feature.
But there’s a solution! I noticed that Terminal.app’s i-beam cursor has a stronger shadow, which makes it easier to see on dark backgrounds. The cursors are just .tiff image files, so it’s trivial to steal Terminal’s cursor and stick it into Xcode.
If you want to do it manually, you’ll need to copy /Applications/Utilities/Terminal.app/Contents/Resources/ShadowedIBeam.tiff over the top of /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff. Or you can just run this snippet in Terminal, which will do it for you:
cd /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources; sudo mv DVTIbeamCursor.tiff DVTIbeamCursor.old; sudo cp /Applications/Utilities/Terminal.app/Contents/Resources/ShadowedIBeam.tiff DVTIbeamCursor.tiff
The change in shadow is actually only slight, but I find it makes a big difference in helping me locate the cursor:
And here’s a before and after:
Update: On Twitter, @TwoLivesLeft pointed out that iTerm’s cursor has even better contrast:
Inspired by Shawn Blanc’s “The Just Checks” episode of The Weekly Briefly podcast.
The Just Checks are those times throughout the day when we ‘just check’ our phones: skim over our Twitter feeds, browse RSS, check our emails, etc. In Shawn’s words:
… as soon as I’m holding my phone, it’s instinct at this point to swipe-to-unlock the thing. And then, once the phone is unlocked and I’m staring blankly at my Home screen of icons, I’m going to want to launch an app. But because I unlocked the phone without any clear plan for what I needed to do, the next thing I know I’m checking Twitter. And all the while, I don’t even know what time it is. See? It’s a bad habit.
I built this widget to help limit my own bad habits of ‘just checking’ Twitter and RSS many many times throughout the day. Apple doesn’t allow widgets on the App Store that launch other apps, so I’m releasing the code on Github in case anybody else wants to try it out for themselves. The widget is currently set up to work with Tweetbot and Unread, and uses their URL schemes to launch the apps.
The idea is this: the widget displays an icon for Tweetbot and an icon for Unread. When an icon is tapped, the associated app is launched. The widget then keeps track of the amount of time since you launched that app. There’s a timeout set so you can’t relaunch an app through the widget more often than once every hour (because really, why should you need to?). I’ve also hidden my Tweetbot and Unread app icons away in a folder on the last home screen on my phone. This adds enough extra friction that I’m more likely to use the widget to launch my apps.
In the short time I’ve been using the widget, I’ve found that seeing the timer when I go to launch an app has been really effective at getting me to just put my phone back in my pocket. I’ve even caught myself going to check Twitter and realising that I’d only checked it 5 minutes ago, when I could’ve sworn it was much longer. I’ll stop in my tracks, lock my phone, put it back in my pocket, and get on with my day.
I like buying apps. Perhaps it comes from being an app developer myself, but I like to pay for apps that I enjoy and that I get value from. Designing and building an app takes a huge amount of work, and I hope that paying for an app means that it’s more likely to receive updates in the future.
I’ve recently had a couple of conversations with people who have never paid for an app, which made me curious about just how much I’ve spent over the years. Unfortunately Apple provides no easy way to see this information. but they do send out regular receipt emails when you make a purchase. I’ve always archived these emails in my Gmail account, so I put together a small script to parse them and produce some figures. I mentioned it on Twitter and a number of people showed interest in it, so I thought I’d reproduce it here.
The steps below outline how I retrieved my own emails and ran the numbers; of course, everybody’s setup is different but hopefully you’ll be able to adapt them to your needs. I use Gmail as my email provider and OS X as my operating system, so all of the instructions are specific to that setup.
First of all, you’ll need to tag all of your iTunes receipts with a unique tag. I have a filter set up for the following search, which tags all matching emails with iTunesReceipts:
from:(itunes store) subject:(your receipt no.*)
Next, download all of your iTunes receipts as .eml files. I used Gmvault to download mine. Grab the tool and extract it. I used the following command to fetch the relevant emails:
The script will first ask for the currency symbol your emails will use; it defaults to ‘£’ if you just press enter. It should then output a count and combined spend for iOS apps and in-app purchases. It’ll also create a tab-separated file named Apps.tsv, which will contain a list of all of your purchases. You can open this in a text editor or a spreadsheet app like Numbers if you want to.
The script could probably be much neater, but I don’t work with Ruby very often and I just threw it together in an evening!
I make no guarantees that this script catches everything or that it doesn’t pick up any false positives. The iTunes receipt format is quite awkward and inconsistent and has changed quite a lot throughout the years. Based on my own receipts, however, this seems to do a pretty good job.
If you have a suggestion for ways to improve the script, feel free to fork it on Github!
So how much have I spent on apps? Turns out, it’s rather a lot. But when I average my spend out over the life of the App Store, and consider the amount of value and enjoyment I get from the various apps and games I’ve bought over the years… I think it’s a pretty good deal.
I’ve been getting really interested in Haxe NME recently. Haxe is an open source cross-platform language, and NME adds a display framework on top of that which is modelled very closely on Adobe’s Flash API. The beauty of it is that you can write one codebase and then compile it to native code for Flash, HTML5, Windows, Mac, Linux, iOS, Android and more.
I was trying to get to grips last night with handling multitouch input using NME, and I struggled to find a decent example. I managed to get something working and so I put together an example myself which I’m sharing here. It’s a simple example which tracks each distinct touch point and displays a randomly coloured circle beneath that touch. I’ve tested it on iOS and Android.