How to fix “duplicate symbol _OBJC_METACLASS_$” iPhone

I got this error while working on my latest iPhone app: duplicate symbol _OBJC_METACLASS_$

Turns out that after adding an NSManagedObject subclass for a Core Data entity I moved the files into a group (to make the files look neater). When I generated them again after updating the entity it create 2 sets of the files in the structure.

Basically I deleted both instances of the files and recreated them and that fixed the issue.

Move UITextFields when keyboard opens in iPhone app

While working on my latest app, I was looking for a solution to slide the screen up when the keyboard opens so that text fields aren’t hidden by it.

I came across this one: TPKeyboardAvoiding its a very simple drop in component. You copy a couple classes into your existing project, put all your elements into a scroll view with the class TPKeyboardAvoidingScrollView and call a simple method and you are done.

-(void)textFieldDidBeginEditing:(UITextField *)textField
[scrollView adjustOffsetToIdealIfNeeded];

Thanks to this article I was able to find this solution.

How to change colour of UINavigationBar

By default the UINavigationBar on an iOS app is blue. Apple have some built-in styles that you can use

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque];

The options available are:

  • UIBarStyleBlack
  • UIBarStyleBlackOpaque
  • UIBarStyleBlackTranslucent
  • UIBarStyleDefault

*UIBarStyleBlackOpaque and UIBarStyleTranslucent have been depreciated. You should use UIBarStyleBlack and set property ‘translucent’ to yes if needed*.

You can also change the colour to any colour you wish using one of the two lines of codes below and adjusting the colour values.

self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.7 green:.5 blue:.2 alpha:1];
self.navigationController.navigationBar.tintColor = [UIColor blackColor];

Exclude Featured image from WordPress gallery

I needed to add the default wordpress gallery to page with a featured image but found that the featured image was also included in this gallery.

The best way I found to exclude this is to add the code below to your site

function exclude_thumbnail_from_gallery($null, $attr)
    if (!$thumbnail_ID = get_post_thumbnail_id())
        return $null; // no point carrying on if no thumbnail ID
    // temporarily remove the filter, otherwise endless loop!
    remove_filter('post_gallery', 'exclude_thumbnail_from_gallery');
    // pop in our excluded thumbnail
    if (!isset($attr['exclude']) || empty($attr['exclude']))
        $attr['exclude'] = array($thumbnail_ID);
    elseif (is_array($attr['exclude']))
        $attr['exclude'][] = $thumbnail_ID;
    // now manually invoke the shortcode handler
    $gallery = gallery_shortcode($attr);
    // add the filter back
    add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
    // return output to the calling instance of gallery_shortcode()
    return $gallery;
add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);

I found this solution here: Its an old post but still works.

Google Web Fonts

I thought that Google Web Fonts deserved a post here.

I used it in a website yesterday for the first time. I have done tests previously but haven’t actually used it.
Admittedly there aren’t as many fonts on there as TypeKit or but they still have a decent selection.

It is extremely easy to pick your fonts and integrate them into your website. To integrate them you just reference a CSS file on the Google servers and then use a predefined name in the font-family css tag.

Its definitely worth a try if you haven’t already and best of all, its free!

WordPress site redirects to

I have just finished cleaning a wordpress website that had been hacked. The site would redirect to which is a malicious website.

Due to this Google began showing a warning page whenever someone navigates to that site, informing them that the site is infected.

I had to go through the site and locate all of the instances of code that looked like this:


This code had been inserted in lots of the files on the site. It can be very time consuming to find the offending files. I cleaned the site by using Adobe Dreamweaver, downloading the whole site, including all the WordPress files, not just the theme files and ran a Find All for “eval” on the entire local site. From there I could see all the files that had the offending code and I was able to delete them and re-upload the cleaned file.

Obviously, cleaning the site isn’t the only thing that needs to be done, change all your passwords for the site and ensure they are very secure. Also make sure your WordPress is up-to-date and any plugins you are using.

HTML5 Boilerplate

This template is a great starting point when creating a new website. The template contains jQuery, Modernizr, uses HTML5 tags and CSS3 also.

The template comes with and index.html page which should be base of all your pages in the site, it also has a 404.html page which can easily be changed to fit your sites theme.The template also handles using HTML5 tags in older tags with the aid of the Modernizr script.

Its definitely worth trying it out for any sites you need to create.