Network sniffing on the iPhone

November 22, 2011

Monitoring the network activity of your device is one of the best ways to debug network related bugs. A lot of times hours of frustrating debugging can be solved by simply looking at the actual packets your device is sending to the internet. Also, and you didn’t hear it from me, it is a very useful method to see what other apps are doing.

This tutorial assumes familiarity with network analysis tool such as Paros and Wireshark. I will not show how to use those tools, or the scenarios where you need to use them, but I will show two very simple ways to use those tool to monitor network activity on your iPhone.

Read the rest of this entry »


Adding custom code snippets extensions

November 1, 2011

One of the most useful feature of xcode 4 was the built in code snippets library. It allows you to use pre made pieces of code instead of writing them over and over.

You can use those code snippets either by dragging them from the Code Snippet Library section, or by simply typing a completion shortcut.

xcode comes with a variaty of useful code snippets which you are more than welcomed to browse, but today I will show you how to add your own custom code snippets.

Read the rest of this entry »

The importance of custom primitive properties in CoreData

October 23, 2011

The topic of this week’s post is responsible for hours of frustrating debugging that I went through the first time I developed a large project using CoreData.

CoreData is really great once you learn how to use it properly, but it’s learning curve is pretty steep. And as if to complicate things a little further, the templates xcode is providing are pretty useless at best, and down right buggy in several cases.

Lets see an example where xcode’s template can cause severe bugs:

Read the rest of this entry »

Instantiating custom views from nib

October 18, 2011

Hi again everyone!

Subclassing UIView to create your own custom class is one of the most frequent tasks an iOS developer has to do.

And for me at least, every time that i created my own custom view, i was torn apart by what is the correct and more convenient way to design my view – from code or from interface builder. I always thought that there was no “right answer”, and that this decision depends on the scenario.
I was wrong. Using interface builder is better. Let’s see why.
Read the rest of this entry »

Animatable text color of UILabel

October 4, 2011

Every time I talk with an android developer about the strong and weak points of iOS development, I always have the CoreAnimation ace up my sleeve. Core animation is great. Not only that it’s so powerful and efficient, it’s also one of the most elegant frameworks I got the chance to work with. In 95% of the cases you can just write

 [UIView animateWithBlock:..] 

and pass a block with the final values of each property we want to animate.

Being the lazy developer that I am, the UIView animation block is a dream come true. This is why I get so annoyed when I encounter a non animatable property, like the text color property of UILabel. That’s right – UILabel, our main component for showing text on the screen, can’t animate all of its text related properties, like textColor, text, font, etc.

If we want to animate textColor, we have two simple but ugly options, and one complicated but delicious solution. Lets talk about the uglies first.
Read the rest of this entry »

How to disable floating headers in UITableView

September 17, 2011

My first post is about an annoying little obstacle apple put in front of iOS developers, when trying to disable the floating header behavior of UITableViewStylePlain. I’ll demonstrate the common approaches when trying to change the default behavior of a sealed apple class.
For all you lazy readers, the answer to the question in the title is only one line long and you can just skip and copy-paste it from the end.
Read the rest of this entry »

Do we really need another iPhone blog?

September 5, 2011

The question in the title is indeed a big one. After all, there are so many great iPhone development blogs out there, my two favorites being the famous cocoa with love, and ray wenderlich’s wonderful tutorials page. (By the way, if you don’t know those blogs, stop reading this post right now and visit them!)

However, the subjects covered in those blogs are limited, and whenever you encounter a really interesting problem, you have to struggle with pieces of answers on stack overflow, to help you build a solid solution. So i decided to chip in and write yet-another-iPhone-blog.

So, Hi everyone – and welcome to CoreCocoa!

In this blog i’ll share some of the more interesting problem i had to deal with, and explain how a to create a reusable and generic solution for them. Most post will be backed by an open source solution you could add “out of the box” to your projects, and of course – any comments and suggestions are more than welcomed.