Core Data Helper – the final chapter!

I’ve probably written about the Core Data Helper too many times for one blog, but I thought just to finish it off I’d write one more article with a good solid downloadable project to demonstrate the use of Core Data Helper.  Basically the helper wraps core data stuff to make accessing it a little tidier… in fact, instead of re-inventing the written wheel (?), why not read about it in the other article HERE and then come back.

So what’s this article all about then?  Well, just below this paragraph is a download link to my project which very basically shows how to use the Core Data Helper.  It also has a useful XML parser for pulling in some default data from an XML file to your Core Data store.  I use this similar format for data which will appear in static lookups and suchlike.  Go download it and take a look…. Continue reading

A basic MapView and annotation tutorial

Map viewI suppose it was inevitable that I’d end up needing to use the Mapkit on iPhone.  For a current project I’ve been required to plot a location on a map so looked at a straight forward way to achieve what I was after.  Thankfully, iPhone makes it very easy to do this.

The following tutorial takes you through creating a project from scratch, which will plot a single point from latitude and longitude coordinates and zoom to that position. Continue reading

Error… wait_fences: failed to receive reply

So right back into the mix after the chaos of Christmas and I’ve come to make version 1.1 of my most recent project.  I started out finding a bug which I hadn’t noticed before (or which hadn’t been vocalised until today) which basically spewed out the error (in the title of this article)

It didn’t stop the app from running normally and the issue was fairly easy to track down, though I thought I’d post the solution just in case you didn’t find it anywhere else.  Yes… I’m talking to YOU!

Okay so here’s where I went wrong.  In my app delegate I instantiate a class to set up my default data for the app.  The content of this really isn’t important.  However, if there’s an issue with that set up – I had the class show a UIAlertView message and this is what was causing the issue.  In the ‘didFinishLaunching’ method of the app delegate where I was calling my class, the view wasn’t yet available.  So when the alert came up, it was just before the view was drawn.  This is what all the fuss was about.

I decided to fix it by returning a BOOL value from the data set up and then after the window was drawn, using the value to display (or not) the warning.  All very straight foward.  Not really sure whether it would have caused an issue in a production app – but good to know anyway.   Other people online reported similar things, but most related to the order in which things took place.

Happy Christmas!

I thought I’d get in there early and wish everyone a very Merry Christmas and a happy new year!  Hope santa brings you all what you want (iPhone / iPod / iPad etc… lol) and expect to see you all here bright and early at the start of next year!

In 2011 I’m going to post some more tutorials (hopefully game related) and other bits and pieces which will give the programming enthusiast a little nudge in the (hopefully) right direction. See you then!

Until then – MERRY CHRISTMAS!!!


Putting a UINavigationController within a UITabbarController

There seem to be quite a few people asking how to use a UINavigationController within a UITabbarController so I decided to put together this very quick tutorial.  We will build a very small (useless) app which will consist of the following…

  • A tab bar with two tab bar items
  • The first tab item will have a standard view controller
  • The second tab item will have a view controller backed by a navigation controller
  • A button which pushes a new view onto the nav controller
  • All of these views will be bound together programatically in the app delegate.

So our application won’t do much – but you’ll get to see one way of making it all fit together.  Okay, here goes. Continue reading

Core Data helper – REVISED

After my initial post regarding the the modified Core Data helper (by Björn Sållarp in this article) I decided to alter it to be a bit more helpful, so I added a few more methods to perform some commonly required tasks. You’ll find the revised class at the bottom of this article. Here are the new methods and examples of how you would use them. For completeness I’ve included the original methods too. The error checking for all the methods has been changed and should be working correctly (they don’t do anything – but you’ll be notified if something didn’t work and can write your own handling). So… after including the class in your file you can do the following… Continue reading

Common iPhone sizes, dimensions and other stuff

Measuring the iPhoneLAST UPDATED: 26th Jan, 2011

I can’t count the amount of time I’ve gone fishing around for dimensions and stuff while I’ve been writing code.  Then usually, this distraction leads me to another distraction and before I know it, I’m playing Black Ops online.  This (lack of) productivity won’t stand, man!   So here for your convenience is a collection of measurements and stuff for the iPhone. I’ve included the high res versions of the measurements too (for the retina display on iPhone 4) Continue reading

Cropping a UIImage on iPhone

As part of a larger project, I was faced with the mini challenge of cropping a UIImage. Seems like a straightforward thing to do (and in fact, it was when I’d finished looking into various ways of doing it).

My requirement was to take an existing UIImage and crop off the top section of the image. To the left, you should see a poor diagram of the crop I wanted to make.  The green area (the full size of the image) is my original image, weighing in at 320 pixels by 480 pixels.  The red area is the area I wanted to be left with, which was to be 320 pixels by 430 pixels (a cutting of 50 pixels off the top!). Lets do it! Continue reading

Too bright or not too bright?

I thought I may was well mention this in a very very short post because I took a lot of time out to search for answers. As we all know, there are certain APIs which Apple don’t allow the use of which include some of the more useful features on the iPhone. A couple of days ago, I was looking into controlling brightness and guess what? You can’t do it. Not with the public APIs anyway.

But I wanted to find out if it were possible with any third party APIs and really couldn’t find anything. Yeah, it seems to be ‘that’ simple. I did see reference to using the following code in a couple of websites – but I assure you, this doesn’t seem to work (not in iOS 4.x anyway). Continue reading

Core Data query helper


I’ve recently started using Core Data quite a bit for a few different projects and quickly found this bit of code and modified it slightly for my own use. It was originally posted by Björn Sållarp through his blog, on a helpful post about how to use Core Data and I’ve continued to use it since in different formats.

The code basically returns a data set from Core Data (with or without a predicate) without having all the messy code for each query. Here’s the code… Continue reading