iOS
Comments

It happened when I was working on an old project that use nib, and I converted it to use autolayout.

Everything was fine, except when I tried to present a table view controller, it crashed.

internal error. Cannot find an outgoing row head for incoming head

This is an error which I could not find a proper solution. But here’s what I did.

1. Convert to storyboard

I suspect it got to do with the nib, and therefore I converted them to Storyboard.

It isn’t that hard. In fact, in 5 minutes, I am done for my main window.

You can copy and paste the views and constraints, so that save a lot of time.

All you left to do is to select the correct View Controller class, then link up to the views and actions.

And that solve the internal error! But.. it still crash when run in iPad.

2. Popover in iPad.

When I present the table view, I use a modal segue.

Somehow, that cannot work for iPad.

The solution is to change to popover segue. (I use a separate storyboard for iPad)

I am not sure if this is an Xcode bug, but that solve the irritating problem.

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 →