How to detect if your app is running on iOS 7

You can query the NSFoundationVersionNumber like so: if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { // you’re running iOS 6.1 or earlier } else { // you’re running iOS 7 or later } Note that if you’re compiling with an older SDK, the value you’re querying may not be defined – in which case, you must define it […]

How to covert an NSUInteger / NSInteger into an int value

Before the addition of 64bit in iOS it was possible to take an NSUInteger (or NSInteger) and put it into an int variable, like so: int arrayCount = [self.myArray count]; If you add 64bit support to your app you may notice a compiler warning when you do this: Implicit conversion loses integer precision: ‘NSInteger’ (aka […]

How to avoid WAL files in Core Data

Since iOS 7 and OS X 10.9 the default journalling mode in SQLite Stores is WAL. In addition to the main store file you’ll find a WAL file with the same (or larger) size as the store file, and a less important SHM file. Prior to this implementation it was easy to save the context, […]

How to link to graphic assets within WordPress Plugins

When you want to display graphics that reside inside your own plugin directory you can serve those via a handy built-in WordPress function called plugins_url. It works just like its counterpart get_stylesheet_directory_uri does in themes. For example, if you’d like to link to a file that resides at http://yourdomain.com/wp-content/plugins/your-plugin/images/your-graphic.png then you can write this URL … Read more

How to link to graphic assets within WordPress Themes

When you’re displaying graphics that are served from your own theme directory, hard coding is never a good idea. In fact it’s impossible because you don’t know your user’s URL. There are a couple of built-in WordPress functions that can help us here. One of them is called get_stylesheet_directory_uri which returns the URL to your … Read more

How to delete a branch in Git

Sometimes Xcode gets confused with the intricacies of versioning. Frequently I find that I’m on a branch, everything is working fine, and for the life of me can’t merge it back into the Master branch. Often this happens because Xcode refuses NOT to make an change, such as update certain files I have already dealt […]

How to encode / convert a .strings file into UTF-16LE in Xcode

When you create a new .strings file in Xcode it will be encoded as Unicode UTF-8. That’s sufficient to hold all the special characters you can dream of. Some translation services such as ICanLocalize require .strings files to be submitted in UTF-16LE though. Puzzled about what this even means I found out that UTF-16LE can […]

How to encode / convert a .strings file into UTF-16LE in Xcode

When you create a new .strings file in Xcode it will be encoded as Unicode UTF-8. That’s sufficient to hold all the special characters you can dream of. Some translation services such as ICanLocalize require .strings files to be submitted in UTF-16LE though. Puzzled about what this even means I found out that UTF-16LE can […]