The Blog

Tip: revert pngcrush optimization in Xcode 4.3

When you are adding PNG images to an iOS app, Xcode will optimize and compress them when compiling, using a tool called pngcrush. To revert this optimization back, copy the .png files from the .ipa bundle into some folder and run this in terminal

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -dir SOME_DIR -revert-iphone-optimizations -q *.png

SOME_DIR is a destination path, something like ~/temp.

Best Couch to 5k iPhone app on the App Store

Seriously, it is.

Go Couch to 5k 2.0 went live last week with much improved speed/distance tracking (way more accurate than before), full dailymile integration and improved integration with Twitter and Facebook. New version features a female coaching voice along with improved mail voice.

If you are thinking should you start running, go ahead and give this one a spin, it’s currently $2.99 on the App Store.

How to: update project build version automatically, in Xcode 4.3

This is very useful if you use service like TestFlight (if you are not, you should) and in general gives you idea how much you worked and tested.

Hey look, I did 500+ builds for the new version.

:)

Anyway, first make sure your project’s Info.plist has Bundle version (raw key name is CFBuildVersion) set to integer value, 0 or 1 or whatever you want as starting value. In Xcode 4.3 this can be set in Summary tab, the Build field, like this:

Version is what you will market to end users, what you will respond when setting up an update in iTunes Connect. Build is mostly for developers and testers, as a reference for bug tracking/fixing.

Next, add Run Script phase in the Build Phases for the main target and paste this script:

buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"

It looks like this in Xcode 4.3

Most important thing here is that this Run Script phase must be before Copy bundle resources. If you forget that, your builds will always be one step behind.

In the end, if you want to show this in your app, this is one way to do it:

[NSString stringWithFormat:@"%@ (%@)",
 [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
 [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
]

 

Re-charging dead Macbook pro battery after a long discharge

Recently my family went away from home for two months. While preparing to go, we left my wife’s Macbook Pro at home and got a bit of a nasty surprise when we returned. The Macbook pro wouldn’t start at all unless plugged-in. And then it showed that battery was not charging and its charge capacity is 0 (you can see this in System Information app). And the green indicator on the MagSafe adapter never went to orange (charging light), even after we left it overnight.

I then recalled similar account by Dan Benjamin – he also left a Macbook untouched for several weeks. The battery discharged so much that it was impossible to kick-start the charging again. He eventually had the battery replaced with new.

The recommendation is that, when you know a device will not be used for prolonged period of time, to remove the battery out (and that charge capacity should be about 40% at that point). In newer Mac portables though, battery is not removable (at least not without opening the case). Thus I assumed that this must be something Apple has thought about. A quick search offered a possible solution:

Unplug the device and all the peripherals.
Hold Ctrl + Option + Shift and Power button for 5-6s, then release them all.

Plugging back in, I was relieved to see the orange light. At first, it showed that charging would take 10h :) but after 5mins or so it got down to normal 1.5h-ish.

Review: WaterField Ultimate SleeveCase for iPad

I’ve long been hearing about WaterField, from the blogs I follow. Two main impressions crystallized over time: good products and good customer support. So when I was getting the iPad brought over from the US, I took the opportunity to order their sleeve case.

I prefer the sleeve case to larger bags. I want my gadgets to be fittingly protected when carried and I’ll then buy a larger bag and just throw each in.
I use Incase sleeve cases for my laptops and in fact wanted to get their sleeve for the iPad too, but was unable to order because they insist on US-based billing address for the card. In this age, that’s rather stupid and it’s hurting their business, but such as life, they sure have their reasons.

 

Thus after checking out few other bags, I decided on WaterField’s. They offer several bag options for iPad and after checking out each, decided on Ultimate model. I especially liked the vertical model, as I could see it fitting perfectly on the side and not dangling back and forth as I walk and getting in the way of my hands. I picked up the larger piggy back case as well, shoulder strap.

I had no problem to use my Serbian card, which was great. I was ordering about a week before the date when it needed to arrive. My cousins were in New York and the bag simply had to be there at least a day before so they could pack it up in time. The first hurdle was the email I received from Waterfield – the vertical bag was out of stock and it could be several days before they had them made. Unfortunately, this moved the delivery date past my D-day. Waterfield offered to upgrade the shipping up, with no extra charge, but it still ended up a day short. So I opted for the 2-day delivery which added 20$. As luck would have it, my cousins eventually stayed for another week, due to Iceland volcano eruption. Such as life…

The bag itself is amazing. Just as I thought, the vertical orientation is perfect and sits so good on the side that it does not get in the way at all. The fit is perfect, snug but not too tight, so it’s easy to put the iPad inside. The interior is padded with soft cloth that can wipe the iPad screen; don’t expect wonders though. In the back they added a tight pocket where you can fit a real wipe cloth, a few pieces of paper or something similarly thin.

I had this bag for over a year now, it’s looking great (especially the worn leather look it gains over time) and no defects nor malfunctions.

The bag is really sturdy and re-enforced on the edges. I can’t stress enough how important that is – if the bag is ever dropped, I’m pretty sure it will protect the iPad even from several meters high.

The piggy back case is very simple, obviously aimed for carrying the wall charger and cables and maybe few more simple items. It was one flaw though – the material it’s made from is the same as the sleeve case. When two of these rubs during walking, they make very annoying sound, especially inside the hallways where it’s sufficiently silent environment. Solution would be to have very small piece of velcro on the back of the piggy case that will attach itself to the main bag.
I plan to do this myself, once I have the time.

In the meantime, I’m using my old usual carry around little bag, which can attach to the iPad bag perfectly. This way I carry these two using one shoulder strap and I can detach the smaller bag when needed and carry just it. Perfect combination.

I’m very happy with the bag and would recommend it to any iPad owner. Without the piggy back case though, at least until Waterfield does something about the noise.

In the mean time, being so happy with this bag, I ordered a whole set of bags and sleeves for the laptops. I got the Suede Jacket sleeve case for both mine and my wife’s notebooks and also Vertigo vertical bags (seriously, don’t ever buy horizontal orientation ever).

Could not be happier with any of these and I plan to keep getting their stuff.