Health Update

Dear friends,

I have some bad news I feel I must share with you: earlier this year I was diagnosed with colon cancer. I’ve spent most of February in hospital for two major operations to remove several tumours and fistulas, and I’m waiting for chemo and radiotherapy to start. The surgery alone has put a major strain on my body and my mind, and I’m not sure how I will react to the next few months of treatment.

This means that I will not be able to write as much content here as I have in the past, if I can produce any content at all. I know this sucks for you as much as it does for me. I’ve been battling with this disease since last year without knowing what it was at that time, and this is reflected in the reduced number of articles I’ve written in 2015.

I will let you know as soon as I feel better, but I fear that it will take the remainder of this year (2016) until I’m whipped back into shape. I have wonderful doctors who look after me, and good health insurance too, who have so far covered all expenses of this distasteful affair. Thank god for that!

If you feel that you’ve been “cheated out of your membership”, please contact me and we’ll work something out. If you need alternatives for learning iOS development, please look into the likes of Lynda.com and Pluralsight.com, who update much more frequently than I ever could. At the same time, they charge you more per month than what I’m asking for in a year to cover the cost of hardware and hosting. And: they’re professional teachers, whereas I am hobbyist hacker.

Thank you for your understanding, and thank you for your loyal support.

All the best, and Happy Hacking,

 

JAY





What’s New in iOS 9.3.2

iOS 9.3.2 fixes bugs and improves the security of your iPhone or iPad. This update:Fixes an issue where some Bluetooth accessories could experience audio quality issues when paired to the iPhone SE.

  • Fixes an issue where looking up dictionary definitions could fail
  • Addresses an issue that prevented typing email addresses when using the Japanese Kana keyboard in Mail and Messages
  • Fixes an issue for VoiceOver users using the Alex voice, where the device switches to a different voice to announce punctuation or spaces
  • Fixes an issue that prevented MDM servers from installing Custom B2B apps

For information on the security content of Apple software updates, please visit this website:

https://support.apple.com/kb/HT201222





How to read MFi Controller input in iOS

Nimbus ControllerI bought a SteelSeries Nimbus controller the other day. It’s Made For iOS (MFi) and supported by many games, including those on OS X and tvOS.

Seriously, it’s a phenomenal controller! Naturally I wanted to see how easy (or difficult) it was to use it in my own projects.

Turns out that for game developers, it’s not that tough to make it work – thanks to Apple’s great GameController Framework that was introduced in iOS 7.

Here’s how I did it, following Apple’s document called Game Controller Programming Guide.

Continue reading





How to avoid “Capturing ‘self’ strongly in this block is likely to lead to a retain cycle”

I was trying to update a UILabel from inside a block the other day, and was puzzled by the above Xcode warning: “Capturing ‘self’ strongly in this block is likely to lead to a retain cycle”. The full code looked like this:

 

self.mainController.controllerPausedHandler = ^(GCController *controller){

        // triggers a warning
        [self displayMessage:@"Pause Button"];

    };

As it turns out, the trouble was that a block executed in self cannot capture a reference to itself (self) without there being a never ending loop involved. It’s probably to complicated for me to understand and/or care about, but thankfully there’s a relatively easy way to correct this problem.

Continue reading





What’s New in iOS 9.3

iOS-120With this update your iPhone, iPad and iPod touch gain improvements to Notes, News, Health, Apple Music and a new feature called Night Shift that may even help you get a better night’s sleep by shifting the colors in your display to the warmer end of the spectrum at night.

Continue reading





How to play videos in iOS 9

Until iOS 8 we could use the trusty old MPMoviePLayerViewController class to play videos on our devices, but that’s been deprecated in iOS 9. From now on, Apple recommend we use the AVPlayerViewController class instead. It has many advantages and even supports picture-in-picture out of the box.

Although AVPlayerViewController is a subclass of UIViewController, instances of it cannot be presented using presentViewController – but Apple make sure not to mention this little tidbit. It’s much more “fun” to figure this out on our own.

Here’s how we can use it with a local video from the main bundle:

@import AVFoundation;
@import AVKit;

// ...

// grab a local URL to our video
NSURL *videoURL = [[NSBundle mainBundle]URLForResource:@"video" withExtension:@"mp4"];

// create an AVPlayer
AVPlayer *player = [AVPlayer playerWithURL:videoURL];

// create a player view controller
AVPlayerViewController *controller = [[AVPlayerViewController alloc]init];
controller.player = player;
[player play];

// show the view controller
[self addChildViewController:controller];
[self.view addSubview:controller.view];
controller.view.frame = self.view.frame;

First we grab a URL to either a local or remote video. Next we create an AVPlayer with this URL, and add said player to the newly created AVPlayerViewController instance. You can auto-play a video by using the player’s play method, or remove it and leave it up to the user to start the video.

Next we’ll present the controller by adding it as a subview to our current view, making sure it has the same frame size.

The class works equally well with local and remote URLs. To play a remote asset, construct the URL like this:

NSURL *videoURL = [NSURL URLWithString:@"https://github.com/versluis/Movie-Player/blob/master/Movie%20Player/video.mov?raw=true"];