Category: Code Snippets & Hints

“Auto Layout on iOS Versions prior to 6.0”

A short reminder, because I ran into this today and Xcode’s very poor at providing you useful verbosity when debugging Auto-Layout stuff done in Interface Builder. Sometimes (Xcode 4.x and 5.x) you might get the following errors when building an iOS project: Going to each error does not help much. Debugging IB auto-layout errors is …

Split NSArray based on characters

Arrays are omnipresent. As I needed a snippet to make a string into an array of values, I thought would be helpful to share this for beginners. For example, take a string variable like, Create an array variable “array1” as:- I used the for loop to know the array1 values, which is displayed in Console …

NSString initWithBytes:length:encoding:

NSString initWithBytes:length:encoding instance method. A quick example. Uses a NSData object from the content of my blog’s first page and displays the string in an NSTextView outlet: The result: A variant, with a char array: The result:

Chasing Zombies in XCode 4

Ok, this will be a short one. Probably I will create a category like “code snippets and hints” to include all these small articles. This is about zombies in your coding projects and how to chase them. Enabling a project to trace zombies is different in XCode 4 than in previous versions. There is a …

How to use XCode 4 Exception Breakpoints

I will probably write a longer article on exception handling in XCode, for now just a quickie: how to use XCode 4 exception breakpoints, use the breakpoint customization features and get useful information for debugging. Usually when the app is crashing, a lot of cryptical mumbo-jumbo is displayed in the console. You have to dig the …

How to convert a mutable array to an immutable array

Really, how do you do this quickly ? Find here.

How to convert an immutable array to a mutable array

Part II of the mutable transformation “saga”. Find here how to quickly convert from immutable to mutable arrays.

Globals and Singletons

My preferred approach to creation and maintaing global variables/ constants is by singletons and singleton instance[s]. Not only is an elegant method that adds compliance to a very important Cocoa design pattern, but also provides you a lot of flexibility.