Xcode 7 + Swift 2 + CoreData = “Unable to load class”

I’ve been toying with the beta of XCode 7 over the past week or so, and came across a rather annoying problem with generated NSManagedObject subclasses. Luckily, there’s a simple fix, but it took some tracking down.

After setting up my data model and generating instances for my first Entity, I would find myself seeing the following error in the console whenever I tried to create an instance of the entity:

CoreData: warning: Unable to load class named ‘MyProject.Entity’ for entity ‘Entity’.  Class not found, using default NSManagedObject instead.

And worse than just getting a warning, none of my NSManagedObject instances persisted.

Continue reading →

TEQuickPageViewController v2.1: Prettier Paging

Time for another update to my code-free PageViewController API! Today I pushed version 2.1 to Cocoapods, with two new features.

First up, I’ve put in an option to stretch the pages right across the view, in order to turn this:

Big, ugly, black bar

into this:

Full view page goodness!

And to complement this, there are now options to set the colors of the scrolling indicators to fit with your theme.

Take a look at the full documentation on Cocoapods, and complete source on GitHub.

Adaptive vs Responsive Design – A super quick overview

In this mobile-heavy world, making sure your website works for a variety of different form-factors is of ever-growing importance. Having a central column fixed at 1024 pixels wide just won’t cut it any more. Both adaptive and responsive design provide their own solution to this problem, but researching them online can be confusing, since a lot of the descriptions are long-winded, and sometimes use the verb “adapt” when referring to responsive sites and “respond” when referring to adaptive. What’s more, adaptive design is often conflated with, or used as a synonym for “Progressive enhancement”.

But it needn’t be complicated, the concepts can actually be distilled to a bullet point each:

* A responsive site will have a single design that adjusts to fit the screen on which it is displayed.
* An adaptive site will have many designs, one of which will be selected for the device being used to view it.

Continue reading →

How to break your UIView with nothing but a background queue

I recently found myself tearing my hair out over some very odd behaviours in XCode. Giving focus to a text view wasn’t bringing up the keyboard, but I could still type where the keyboard should have appeared. I spent days trying various tweaks and changes to get it working, blaming this library and that library, but as it turned out, the solution was very simple.

PERFORM YOUR SEGUES ON THE MAIN QUEUE!

Continue reading →

XCode Missing a Spot when Cleaning Builds

Found myself with something of a head-scratcher today. After pulling some changes from an iOS project, I fired it up in XCode only to get an error:

Property <property name> not found on object of type __strong <object type>

I carefully scanned the offending line for typos and couldn’t see anything amiss. I tried a Clean of the build, seeing the same error on rebuilding. Since the class in question was in a file imported through CocoaPods, I tried rebuilding the Pod project, but still got the same error.

I wondered if there might be a duplicated name somewhere, so I tried Option+clicking on the protocol name where I found the error. This took me to the header where I expected the property would be missing, but, surprisingly it was right there.

Apparently, running Clean on the build didn’t actually clean everything up.

After searching around a bit, I came across a StackOverflow post from a few years relating to clearing caches for xibs, so I tried deleting everything under:

<em>~/Library/Developer/Xcode/DerivedData</em>

I hit build again, and bingo! No more annoying error. Thanks to matt for getting me out of an annoying tight spot!

 

TEQuickPageViewController v2: Even Simpler Paging

A couple of weeks ago, I put together a CocoaPod to make creating paged views in iOS easier. I knew there was a bit of some for improvement, so I did some research and today I pushed version 2.0.0 of TEQuickPageViewController, which makes storyboarding your pages even quicker!

Using segues to set up your pages.

Having discovered the wonder that is the custom segue, I realised I could use custom segues that didn’t actually perform a segue to construct a sequence of view controllers that could be reported back to the Page View Controller.

This means that you can now see your sequence of pages at a glance in your Storyboard. Zero code, zero confusion.

[TEQuickPageViewController v2 on GitHub]

Simpler paging in iOS

Yesterday, I started wrestling with the concept of Page View Controllers in iOS. These are the swipeable sets of screens you’ve probably seen holding tutorials and “what the heck is this?” explanations for all those weird and trendy apps floating around. Frankly, I found it to be a massive pain in the butt, so I knocked together a little project to make things simpler.

Setting up your pages in Storyboard. No, this is nothing to do with Windows. Or the game Simon.

Continue reading →

Redis on Laravel: Why naming is a pain

Screen Shot 2014-10-30 at 22.44.50It’s Thursday night, and you’re looking to start using Redis in your Laravel application. You fire up your Homestead box (more on this in another post), open your favourite IDE and put in a new route to start playing around. Just something simple to start, write then read a value, just like the example.

You save, and load up the route in your browser, only to see:

Call to undefined method Redis::connection()

That can’t be right, can it? The Redis class is built-in to Laravel, and connection() was in the example. How can it be missing?

Continue reading →

Test your Twitter Vocabulary

TwitterTime for another quick project! This time, I’ve put together a vocabulary tester for Twitter. Just put in your twitter handle, and get an outline of your most used and longest words.

The app is implemented under Laravel, using the Twitter APIs to pull tweets for processing. To get around potential memory and time contraints on PHP scripts (and to provide feedback on progress), I used AngularJS for aggregation and rendering of results. Bootstrap and Font Awesome provided quick styling.

Continue reading →

Quick Project: Asteroids with SpriteKit

After an extremely long hiatus from my Shoot ‘Em Up project, I was itching to see what was new in the world of iOS game development. Discovering the new SpriteKit API, I just had to give it a try. So I put together a quick version of Asteroids over a few weekends.

SpriteKitAsteroids-1

It’s missing a couple of features (no hyperspace or flying saucers), but was a great way to get to grips with the new API. Not only that but I also got an excuse to play with Git’s submodules feature, which I’m sure I’ll be using a lot more in future.

You can see the full source on GitHub, feel free to download and build a copy!

GOG – A Video Game Nostalgiagasm

GOG LogoAs any mobile video game developer from the first wave of smartphones can tell you – a small group, but a proud bunch – nostalgia sells. So if you were a PC gamer in the 90s and 2000s, GOG.com might be right up your alley.

I’ll admit, I’m not a big gamer, I’ll occasionally get hooked on a story based game here and there, but I’m not the sort to spend hour after hour fragging whiny teenagers or trolling frustrated Call of Duty players. But I do get misty-eyed when I think of my childhood days playing wonderfully crafted low-res strategy or point and click games. And luckily, some part of me has managed to ignore all the frustrated hours spent trying to get DOS to actually run those games (does anyone know what an IRQ setting actually was?).

Continue reading →

App Review: Level Money

Your spending allowance, and that's it.

Your spending allowance, and that’s it.

I hate budgeting. Compartmentalising my spending into arbitrary, inflexible ring-fences I can’t possibly stick to has never seemed to work, for some reason. Luckily, someone’s come up with a budgeting app that doesn’t actually require much budgeting.

Level Money is a new money management app for iOS and Android that tells you simply what you can spend each day. And that’s all. You don’t have to predict how much you’ll spend on food, you don’t get stuck deciding which bill to ignore because you needed a new winter jacket. All you need to do is to watch what you spend for the day.

It’s beautifully simple and perfect for someone like me who isn’t organized enough to do a weekly food shop. It’s the app I’ve been waiting for since I moved to Manhattan with it’s eye watering rents. In fact, I was working on something similar myself when Level was released, and I was delighted to see they got it right! Continue reading →

How to Configure Laravel on MAMP

Laravel is a powerful framework to speed PHP web development, MAMP is a handy GUI to allow quick and easy testing of websites on OS X. Smash them together and you get quick and easy web development on OS X.

My work at Spotflux has recently involved a lot of PHP development to build an account management portal for our new Premium service. This had to tie in to our exiting web APIs (which I’ll admit were a little cobbled together) and be backwards compatible with our existing database. And it had to be done yesterday. Continue reading →

Where the heck have I been?

Shockingly, it’s been over six months since I last posted to this blog. But this isn’t because I’ve been lazy, uninspired or disillusioned. I’ve just been extremely busy through a combination of a new job, moving abroad and getting caught in a hurricane.

In April, I took a new job at a New York based startup, spotflux. spotflux (lower case ‘s’ intentional) provides a free VPN service designed to protect your privacy and security. All you need to do is download and launch the app, and it will encrypt all your internet traffic, block ads, malware and tracking code and provide you with an anonymous, US IP address.

Continue reading →

iOS Shooter Project Part 5: Choosing APIs

As great as the iPhone SDK is, it wasn’t designed specifically for games, so a mini industry has sprung up to provide game developers with APIs and tools to make their lives easier. So I’m going to raid the repositories and see what I can use for my project.

Admittedly, it’s been a while since my last iOS Shooter post. Hopefully I’ll soon be able to explain all the exciting things I’ve been doing of late, but for now, here’s the next step in my game planning: API selection.

While using third-party APIs isn’t necessary by any stretch of the imagination (thanks, Mr. Turing!), there are a lot of common problems and tasks that they can simplify greatly. Animating sprites, for example, can be incredibly tedious to code directly with OpenGL. Not only that, but – as I discovered when writing Togolon – physics is hard! Given I want this to be a short project, I’ll take any short cuts I can.

Continue reading →