iOS
Comments

This is very well answered in StackOverflow.

1
2
3
4
5
// Version is the readable dot notation eg `1.2.3` or `5.0`
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];

// Build can be any string eg `789` or `8A400`
NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
Comments

I have everything setup correctly, but just somehow the localized string is not correctly showing on simulator/device. It is still showing the base string.

I find out this could be due to a change in your base storyboard, and yet it is not correctly reflected.

To resolve:

  • Select the localized storyboard eg. Chinese (Simplified)

  • In File Inspector, toggle from “Localizable Strings” to “Interface Builder Cocoa Touch Storyboard”. This will retain the strings you already had, so you don’t have to worry.

  • Now, change it back to “Localizable Strings”, and things should be updated!

iOS
Comments

There are times when you want to have the same database in both a device and a simulator. For my case, I have a photo application which takes photo using the camera. That cannot be nicely tested using a simulator, hence I always test with a real iPhone.

Then comes a time when I want to move the database to simulator, which is faster to run.

This post explain the steps of copying over.

Continue reading →
iOS
Comments

Core Data remains a nightmare framework, with many lines of code to get started.

Apple provides a snippet section just for Core Data. Browse through it, be afraid, then appreciate the 2 libraries I will be introducing here.

MagicalRecord and mogenerator are 2 popular libraries to use when dealing with Core Data. NSHipster mentioned others, but these 2 are the must use.

In this post, I will explain a step by step to set them up, for there is a lack of proper documentation.

Continue reading →
iOS
Comments

This isn’t a big secret at all, yet many developers are not utilising the code snippet feature. Myself included.

But I am now making a habit of using my code snippet library, which is conveniently synced to my Dropbox.

Remember, programming isn’t about being an expert in typing or memorizing code. So help yourself to code snippets!

Continue reading →