Removing Push Notifications from NotificationBar

I have come up with a weird problem…. which goes as follows:

  1. The app receives a Push Notification.
  2. You tap over the PN (in the iOS notification center).
  3. The app gets launched… and you handle the notification
  4. Problem: the notification remains in the ‘notification bar’.

How do you clean it ?. Well… this isn’t in Apple’s docs. But i’ve figured out that if you execute the following line of code, the notification ‘gets acknowledged’:

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

Nice, ha?.

 

JSON Parsers

XML days are numbered…. it’s just my opinion. I know, it’s out there in the wild, almost everywhere. But XML itself has a huge overhead, which is something we, as mobile software developers, really want to avoid.

Personally, i just love json. It’s extremely lightweight… and i dare to say, it is what XML should have been. Why is it exactly that you need to repeat a keyword once and over and over…???. I still don’t get what those guys were thinking… when they wrote the XML specs.

Allright. Enough with bashing outdated standards!. How do we parse / serialize JSON ?.  Apple itself has a parser / serializer. But there are faster alternatives.

NXJson was written by a friend of mine. Although it’s not the fastest parser out there, it’s pretty amazing. Go get it, it’s under MIT license, so you’re free to use it anywhere. And good news… it also works on Mac!

The second alternative is JSONKit. That is indeed the fastest parser in the market. Which one to get?. Both are free… just download them both, and study their source code. That’s the coolest thing about open source. Your skills can increas substantially just by reading other’s work.

And at some point… we should return something to the community…!!.

HTML Color to UIColor

This is a nice tool i’d like to share with you. While skinning your app, you might need to convert HTML color codes into those that are actually accepted by UIKit framework (which, by the way, is HEX!).

So… you need to fire Photoshop, or find a website that does that for you. Well, i just found a nice app called HexColors. It’s in the Mac AppStore, and it’s free (go get it!).

It allows you to convert html colors, straightforward, into an ObjectiveC NSColor… which, by the way, looks like this:

[NSColor colorWithCalibratedRed:0xFF/255.0 green:0xFF/255.0 blue:0xFF/255.0 alpha:0xFF/255.0]/* FFFFFFFF */

So… if you’re also working on iOS, you just need to weak that sentence to look like this:

[UIColor colorWithRed:0xFF/255.0 green:0xFF/255.0 blue:0xFF/255.0 alpha:0xFF/255.0]/* FFFFFFFF */

I know. That’s an extra step you have to take. There is also another version that actually has UIColor support, but it’s a paid app… and… i don’t mind replacing two words… it’s not THAT much, right?.

I hope you find it useful!

UITableViewCell without borders!

Suppose that you have an UITableView with a borderColor. Everything is cool and easy… as long as you don’t need to break the mold.

But if you ever need to add just ONE single cell without borders, you’ll notice that there is no way to do it. Well, it turns out that there is. But it’s not a straightforward one. You simply need to do this:

UIView* emptyBackView = [[UIView alloc] initWithFrame:CGRectZero];
[cell setBackgroundView:emptyBackView];

[emptyBackView release];
emptyBackView = nil;

Magic, ha?. If you add an empty backgroundView (with its background set to clearColor), the cell’s border will be gone.

I’ve been using this trick since iOS 3.1.2 times… and it’s still valid for iOS 5.1, so go ahead, and get rid of those borders!

Foo Fighters in Argentina!!!

I’ve been to Foo Fighters concert in River Plate. Let me tell you something about this band…. THEY ROCK!!!

It clearly was the best concert i’ve ever been to. It seemed that they actually enjoyed playing. Other big bands, such as AC/DC or Rolling Stones, seem to play just to make money. But they… they took the stage while it was raining. And no, they didn’t have a roof covering them.

They played for almost 3 hours… and we even got Grohl to play drums, which was the closest thing to listening to Nirvana (live) i’ll ever get. THANK YOU!

I just wanna paste here the tracklist, because… i don’t wanna forget about that… ever!.

01 – All My Life
02 – Times Like These
03 – Rope
04 – The Pretender
05 – My Hero
06 – Learn to Fly
07 – White Limo
08 – Arlandria
09 – Breakout
10 – Cold Day in the Sun
11 – Long Road to Ruin
12 – Big Me
13 – Stacked Actors
14 – Walk
15 – Generator
16 – Monkey Wrench
17 – Hey, Johnny Park!
18 – These Days
19 – This is a Call
20 – In the Flesh? (Pink Floyd Cover)
21 – Best of You
22 – Enough Space
23 – For All the Cows
24 – Dear Rosemary
25 – Bad Reputation (Joan Jett cover)
26 – Everlong