The personal blog of Stuart Breckenridge

GameKit Replaced in iOS 9 Beta 3

One of the smaller changes I overlooked in the iOS 9 Beta 3 API diffs was that GameKit had been replaced with GameCenter. Attempting to run an app without making changes led to a strange error with the YouTube.framework:

dyld: Library not loaded: /System/Library/PrivateFrameworks/YouTube.framework/YouTube  
  Referenced from: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/ReplayKit.framework/ReplayKit  
  Reason: image not found

To resolve, link to the GameCenter framework and replace:

import GameKit

with

import GameCenter


Singapore Botanical Gardens Added to UNESCO World Heritage List  

“Situated at the heart of the city of Singapore, the site demonstrates the evolution of a British tropical colonial botanic garden that has become a modern world-class scientific institution used for both conservation and education. The cultural landscape includes a rich variety of historic features, plantings and buildings that demonstrate the development of the garden since its creation in 1859. It has been an important centre for science, research and plant conservation, notably in connection with the cultivation of rubber plantations, in Southeast Asia since 1875.”

UNESCO


It’s quite an incredible place.


David Cameron: No Safe Space From Government Snooping  

“David Cameron was replying in the House of Commons on Monday to a question from the Conservative MP David Bellingham, who asked him whether he agreed that the “time has come for companies such as Google, Facebook and Twitter to accept and understand that their current privacy policies are completely unsustainable?” To which Cameron replied: “we must look at all the new media being produced and ensure that, in every case, we are able, in extremis and on the signature of a warrant, to get to the bottom of what is going on.”

Glyn Moody


How can this be achieved without implementing backdoors in every type of encryption on messaging platforms? iMessage is great example of an everyday service that’s encrypted end-to-end1, with no way for Apple to decrypt the messages in transit or on device.

It’s simply not possible to achieve what the Conservative government want without building backdoors into encryption. And building backdoors for one group means building backdoors for everyone.

  1. Read the iMessage section of the iOS Security Guide↩︎


Apple Music Availability

Apple Music is finally live and everything works for me, except Beats 1, which throws a 403 error.

It turns out Beats 1 isn’t available in Singapore. If you’re receiving the same error check out the list of countries with Apple Music availability just published by Apple.


Meet bPay – Barclays answer to Apple Pay.  

Just spotted this on The Next Web:

“British bank Barclays would prefer if you used its own hardware to pay for your next purchase rather than your phone. It announced today three ‘bPay’ devices for making your next payment: a wrist wearable, a keyfob and a sticker for your phone.”

  • A wrist wearable that only allows you to pay for things. No fitness or time keeping features. It’s certainly focussed.
  • The keyfob is acceptable: it’s small enough that it wouldn’t get in the way.
  • The sticker isn’t even something I’d consider - it detracts from the design of the phone.

The clincher? Barclays expect you to pay:

“bPay devices will be available from July 1, starting at £14.99 for the sticker, £19.99 for the key attachment and £24.99 for the wearable wristband.”



Fitness Bugs in watchOS 2 and iOS 9

I’ve been using watchOS 2 and the iOS 9 betas for app development, but with a marathon coming up I thought I’d see what state the fitness and activities apps were in. Below are the issue I’ve come across:

  • Activities glance UI is distorted. (Radar: 21582510)
  • Activate on wrist raise during workouts is slow. (Radar: 21582523)
  • Watch OS 2 and iOS 9 do not connect to external heart rate monitors. (Radar: 21582562, 21582581).

Another important note for those considering the update to the watchOS 2 beta: there is no known downgrade path back to watchOS 1.0.1. Apple hasn’t announced an equivalent to the iOS DFU mode. If you upgrade you need to stick with watchOS 2 for the entire beta cycle.


Optional vs Empty Table Views in Swift

A recent post on Natasha The Robot looks at different (but equally valid) approaches for handling the display of data when table views are empty or optional.

I prefer a variation on the non-optional approach using the didSet observer.

// Tableview Data Source
var dataArray = [String]() {
        didSet {
            dataTable.reloadData()
        }
    }

didSet is not called during initialisation of the array, so using the observer ensures that the tableView isn’t reloaded until a new value is set.

In viewDidLoad, I hide the tableView until data is available:

override func viewDidLoad() {
        super.viewDidLoad()
    
        // Hide TableView 
        dataTable.alpha = 0.0
        
        // Load TableView
        loadTableViewData()
    }

loadTableViewData parses JSON in the background and passes an array back in the completion handler (which is called on the main thread)1:

private func loadTableViewData()
    {
        // Show indicator while loading.
        UIApplication.sharedApplication().networkActivityIndicatorVisible = true
        
        let parser = JSONParser()
        parser.parseJSON { (list) -> Void in
            // Hide indicator, set dataArray to list, show tableView
            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
            
            self.dataArray = list
            
            UIView.animateWithDuration(0.2, animations: { () -> Void in
                self.dataTable.alpha = 1.0
            })
        }
    }

In the UITableViewDataSource functions, there is no need to consider optionals:

extension ViewController: UITableViewDataSource
{
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return dataArray.count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as UITableViewCell!
        
        cell.textLabel?.text = dataArray[indexPath.row]
        
        return cell
    }
}

I’ve uploaded a sample project to GitHub which contains some sample JSON.

  1. I’m using networkActivityIndicatorVisible as a placeholder to show parse progress. ↩︎


New Website

I’ve been on Wordpress, SquareSpace, Tumblr, and Ghost. All of them were good in their own way, but didn’t give me the level of control I wanted. So I’m giving Jekyll a try.

Content from my old website is still in the process of being transferred1. You’ll may also see some broken links for a while as Amazon’s Route53 has really screwed up the DNS records for my old domain.

A bit of background on the design:

  • The theme is Minimal Mistakes.
  • Typography is provided by Cloud.Typography. Currently a combination of Whitney and Ideal Sans, though I’ve been known to chop and change.
  • Hosted on Amazon S3 and distributed via Cloudfront as the CDN.
  • RSS is provided by FeedPress.
  1. I’ve had to export from SquareSpace to Wordpress, and then Wordpress to Jekyll. ↩︎


Destiny: The Taken King director defends £40 expansion price tag  

Update: Bungie has reversed course and will now sell The Taken King as separate DLC with access to all the exclusive content, without the need to repurchase all content.

“Bungie has defended the full-fat £40 price tag of Destiny’s upcoming major expansion The Taken King, as well as the fact that fans will have to rebuy the base game and its existing two add-ons to access exclusive content in The Taken King’s Collector’s Edition.”

Putting DLC behind a paywall is fair game, but putting exclusive DLC behind a paywall that requires you to rebuy everything you’ve already bought is criminal.

The Q&A in the article is astounding: I’ve never seen a Bungie employee give such poor, arrogant, and dismissive responses.

Eurogamer: Well, yeah. I would rather do that - pay a few pounds or dollars or whatever - than spend money on things I already own.

Luke Smith: [Laughs] Well, we have nothing more to talk about regarding your opportunity to spend extra money in Destiny, other than The Taken King and the three versions we’ve announced.