useful xcode debugging methodologies

developing for the iponhe is not a simple thing. cocoa is designed with specific patterns in mind, a dominant model-view-controller, performance oriented with specific ways of going about things. xcode is your best friend, believe it or not. the apple documentation is there for you as well, and many hours were spent to create coherent manuals that will assist us in doing a great job. and doing a great job is a must, because mobile devices are not as browsers. memory foot print is really important. if you over due it, your app will be removed by the OS and UX breaks. bad karma indeed.

dealing with memory leaks and zombies is an important issue, and below i will provide a couple of useful tips to setting up xcode in such a way, and arranging your code, so you have more control and understanding of what’s going on under the hood.

first up, i assume you are familiar with:

- reading a call stack
- play around with the expression window
- use the memory browser when needed

if you are not, you probably should read up on those and play around with them. very useful tools to get the gist of what is going on with your app.

tip #1:
- always archive your dSYM (short for debug symbols) along with the app you send for your QA guys (the “testers”). this is really useful, as once they email you back crash logs (which they will), the data in the log will actually make sense, i.e. the symbols are mapped correctly and you will see actual method names rather than HEX addresses.

tip #2:
use the symbolicatecrash script and pass it the .crash file and .dSYM file. this will allow you to mesh the two together and review what had happened. from the command line, execute ‘find /Developer/ -iname symbolicatecrash’. grab the path and add it to your ~/.profile (if you are a bash kind of a guy). add this line: “PATH=/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/ \
Versions/A/Resources/:$PATH” and don’t forget to “source ~/.profile” before you try and access the script.

tip #3:
enable malloc_error_break so xcode will halt when you double release an object or release a stomped memory. this directive for the debugger is actually a breakpoint. think about it, what we are asking xocde to do, is break on a memory allocation error as if it were a breakpoint (rather than crashing). this is very useful as the program will halt on the line of code that tried to perform the illegal action. add this to your project from the breakpoint view. easy as pie.

tip #4:
party with the zombies. edit your schema (xcode4 people can you hear me?) and add NSZombieEnabled = YES to the “environment variables” list. what happes here is fun. xcode will not release your objects when their reference count is zero, but will keep them for safekeep within the framework of the app. if any of the pseudo released objects is being sent a method, xcode will halt your application, load the debugger and point you to the line of code that tried to access what is suppose to be a zombie. how cool is that? caution! this method is a heavy memory foot print so take it under consideration when you enable them zombies to roam your lands.

on my next post i will show you a nifty header file that allows for fast turning on and off of debug calls from within your app.

good luck!

 

top picks for 2010 from the appStore

2010 has been an incredible year for the mobile space, and as crazy as things may appear, this is only the beginning. with the advent move of the smart TVs and slated devices, we are bound to see more innovation for both corporates and consumers alike.


here is my short list of top apps for the iphone first, at random order:

VOIP:
skype: veteran at it’s field. skype is affecting the bottom line by saving money. $3/month for unlimited calls in the US, the ability to work over 3g and soon facetime is where the industry will be, no matter how much carriers want to extort the end users. bar none, skype is keeping us all connected. with PBX integration and a future IPO this company will continue to dominate and lead the way in it’s field.

SOCIAL:
facebook: this facebook app is a fantastic example of how apps can pack zest with style. this is the top used app because it’s well done. nothing much to say, we are all on it and loving it.

foursquare: i am a big fan of the NY based company. real time, location based (and soon NFC), 4squre has started something great that is echoing throughout. mayorships, badges and a solid business plan. i hope for more goodness from these guys.

PHOTOGRAPHY:
fotomecha: probably my favorite camera app (for still photos) in the appStore, because it allows me to be creative and capture moments i.e. more than one moment, and create a flow in time.

itimelapse: for video capable iphones, this app allows timelaps video creation with some nifty features for creative control. you need to be patient and stable, or maybe you need the glif.

MUSIC:
FiRe: top recorder which integrates well with soundcloud. i use it often to record music,conversations etc. these guys are fantastic with performance and know the audio frameworks well. money well spent.

SPL meter: i use this app to know when the sound around me is affecting my hearing. hearing gone bad cannot be regained. those tiny hairs in the hearing tube will not grow back. sounds particular and you may call me old fashioned, but no concert/club in the world is worth loosing our hearing for.

READING:
goodreads: bar none, the top app to sync your pdf files for offline reading. i also sync movies to it and this is the reason i get more done. 30m on the subway is a great time to launch this app (both iphone and ipad). with the ability to sync documents from dropbox, google docs and others, this app packs a punch of useful features.

HOME:
airphones: great little app that turns the iphone into a wireless headset over wifi. you will need to install a server on your mac or windows machine.

mobile mouse: while you have airphones streaming audio from your mac mini, which is hooked up to a 50″ plasma, you will need to launch a browser and go on veetle.com. this app is the best i’ve seen and worth every penny. again, you will need a server running on your machine.

 

Calunga

the past couple of months have been as crazy as it gets. i have been diving deeper and deeper into iOS technologies and am coding for the iPad non stop. i must say that i really enjoy working with xcode and objective-c and the potential is endless. soon koi will lift off the ground and make this world a better place :)

calunga, a song i wrote while traveling brasil in 2009. calunga means “sea” in many native west african languages. calunga also means death, and by the teaching of yoga – we die in order to be reborn little by little, every day, while evolving to a higher state. it is our daily practice and commitment toward achieving our goals that compels us to overcome fear and grow stronger.

this is exactly what the people of west africa must have experienced when pulled out of their homes and brought to brasil – a rebirth that is so incredibly embraced there.

this song symbolises the peace i had found and the unity with the ocean, the atlantic forrest and the people. truly is an incredible place. i’ve added a gallery of some of the photos i’ve taken there to go with the music – play both at the same time to get the full experience of the music. be inspired!

the song was recorded at Mal Stein studios

Calunga by pengas

Pure West for iPhone and iPod touch on the iTunes App Store

My first iOS app is live on the app store. It is an iPhone compatible schedule for Pure Yoga West, one of the top yoga centers in NYC in the upper west side. The app is free for download from the AppStore.

This project started off when I joined Pure West as a member. Yoga became a big part of my life as I practice on daily basis. Since Pure West offers around 27 different kinds of yoga between 5 studios, starting as early as 6am – you can imagine the teachers they have as staff and the frequency they update the schedule.

Something was broken. The paper schedule provided at the front desk was out of date as soon as it was printed. Could be a minor change to a single class, to time of full moon where ashtanga is not practices (which can not be reflected in a single week sheet), to the twice a month led practice of mysore.

Pure uses spa-booker as their service provider, doing all the heavy lifting with proprietary database system and interfaces to both manage the content and display it to the public. it gets more complicated than that as some classes are special and specific where members (or non members) need to pay and more.

Since spa-booker is working on their own version for the mobile devices, and I knew I am in need of a solution for myself that can probably serve others – I jumped on the challenge to create something.

Working closely with two friends, Tomer and Claudio, together we build this app that does the following well:

- single click to get class schedule and class info
- fast loading of the data
- layout that matches the small iphone screen

Essentially we build a system that scrapes the HTML of the entire week. Then we parse the content diligently and store it in our XML proprietary format. The interface picks up the XML whenever someone launches the application and displays it on screen accordingly.

For performance reasons we are re-visiting Pure’s website every two hours to see what had changed, parse the content and re-write the XML. On the client side only one day is loaded from the server. When a user changes a day, we go back to the XML and look for the content of that day exclusively.

The app is a UIWebView essentially, as the app is developed as a web application. The release to the AppStore will help the discovery, but also for us to learn the process and time line for doing so, as we plan to move forward with other developments of our ideas and our client’s.

The beauty of iOS apps is that they strive to keep things simple. When you launch the application, it is really hard to judge how much work was put into it, and how much lifting is done in the background. Things just work as they should, both in layout, style and user experience, including performance specifically.

One of the advantages of designing this app abstractly, is that now we can custom create it for any spa-booker customer within the day.

We are in touch with Spa Booker who are supporting our efforts. Future plans may include using their API’s to book classes directly from the phone, add more specific information to classes, like which element of zenyasa is being practices today, and provide a delta of changes since a user last visited the schedule.

The Pure East application (the 2nd location for Pure on the upper east side) is pending approval by Apple. Based on the approval of Pure West, it is a matter of days before that one will be approved as well.

 

Google music – with hopes for innovation

Google’s new advent move into the world of streaming music is exciting. Well, not quite yet… but the idea of some innovation around music delivery (and maybe discovery) can POTENTIALLY be exciting.

What are we looking at here? As most things go – we are looking at Apple delivering over 1M songs per day (do the math) directly into iPod/iPhone etc. Apple also just relieves Ping, their brand new, let’s live inside iTunes social networks that spirals around music (great niche if you ask me).

What can google do that’s creative, innovative and will convince people to use their service and BUY music (at some form) from them? First, is a platform that is built for android based phones where you can interact with your media (discover, stream, share and sync). Second is pricing. Beating Apple’s pricing is tricky and I am not convinced it will be done – there is a better battle ground on platforms. over 200K android based phones are being activated every single day – more than enough for Google to capture a nice market share. Couple this with the advent of Google TV where you will be able to stream your music from droid to the TV, snyc em all over the net, and you have a really tight, head-to-head competition between Google and Apple that will benefit us all.

How can Google make this service better? One answer lies across the pond where a company named Spotify is making big moves and capturing the imagination and pockets of the audience. Spotify is a brilliant combination between iTunes and Pandora. With Spotify you can the choose any song you want to play and it will stream right to the Spotify player. Pretty neat right? With Pandora you can create a playlist based on a song, which will, eventually, be played down the play list. Spotify is instant gratification without the need to pay.

It is says that Spotify has been trying to make a move into the US, but had hit some walls, and/or is working diligently to negotiate the terms and fees and bla bla… long-short, no iphone based spotify nor desktop in the US as of yet.

I hope to hear great news from Goolge in regards to this up and coming service. One way to make it kick ass is add a new layer of interactivity. Think of what MTV did back in the 80s when they added the video to the music. Companies like Lucid Technologies, with their product KOI are doing the same thing, allowing musicians to interact with the songs as musicians and not only listeners.