iOS
Comments

I encountered a weird error when using UICollectionView, where the storyboard is using autolayout.

This is the error:

1
2
3
4
5
6
7
8
9
10
Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7fda6411de70 H:[UIButton:0x7fda6411dc90(13)]>",
    ...
    "<NSAutoresizingMaskLayoutConstraint:0x7fda61cf61e0 h=--& v=--& H:[UIView:0x7fda6411d500(50)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fda6411de70 H:[UIButton:0x7fda6411dc90(13)]>
Continue reading →
iOS
Comments

I was once writing a simple piece of code, something along the line of:

NSString *name = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];

It turns out strange that when I run in Release scheme, name is nil when I inspect the variable in debugger.

When I run in Debug scheme, it is fine. The code returns the app name as you expected.

Continue reading →
Comments

An interface is two things: it is a set of methods, but it is also a type.

When you first learn Go, interface is always introduced as a common methods for some types.

A lesser known feature is that interface{} is a type – the empty interface with no methods. Therefore all types have already implemented interface{}.

One good use is in map[string]interface{} – where the key is string and the value is any type. You can read more about interface values.

iOS
Comments

Every new version uploaded to iTunes Connect needs to have a different build number in order to differentiate the version.

Note: Build number (eg. 1234) is different from Version number (eg. 1.2).

The build number can be automatically increased in these few ways:

Continue reading →
Comments

After upgrading to Yosemite, your brew could run into an error:

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0
Continue reading →