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 →