Wednesday, December 8, 2010

Moving from NSLog to better logging

I've wanted to improve the logging in my apps for quite a while. I've searched and found a number of websites that talk through different options. I found these to be quite helpful:
http://stackoverflow.com/questions/969130/nslog-tips-and-tricks
http://cocoaheads.byu.edu/wiki/different-nslog

But I didn't see a "finished" solution that was polished like I wanted it to be. Here is what I wanted:
- Easily turned off; don't run in a distribution build
- Short to use; NSLog short. I don't want anything longer
- Show the method name and line number

The solution I came up with looks pretty good. To use my logger, all I have to do is use a GPLog() statement, just like NSLog(). The cool thing about that it is that it made for an easy find and replace to use it through mode code. Statements like GPLog(@"%d", numberVar); will work just like NSLog does. The statement GPLog(@""); will produce something like this in the log.

2010-12-08 16:19:07.537 GW Mail[8016:207] -[AppDelegate_Phone application:didFinishLaunchingWithOptions:] (33) ::


I put the following in my .pch file so that it would be globally available.

#define kDevMode

#ifdef kDevMode
#define GPLog( s, ... ) { \
NSLog( @"%s (%d) :: %@ \t", __PRETTY_FUNCTION__, __LINE__,\
[NSString stringWithFormat:(s), ##__VA_ARGS__] ); \
}
#warning kDevMode ON!
#endif
#ifndef kDevMode
#define GPLog( s, ... ) { }
#endif

A few things to notice. To turn logging off, all you have to do is put an x or something in front of the #define kDevMode statement.

When the logger is turned on, it throws a warning. This helps you to remember to turn it off before you do your distribution builds.

It's pretty straight forward code. Hopefully this is helpful to someone!

Saturday, May 22, 2010

iPhone Analytics

Pretty early on when I started developing iPhone applications, I added analytics to my apps. Specifically Pinch Media's package. Until recently I have been pretty happy with the analytics I've gotten from their system. Not that long ago, Pinch Media was absorbed into Flurry. That's when things went bad. Specifically:

1. Flurry reports session based analytics. Interesting if you are a free/add based developer. Not so much for a paid app developer. Pinch was much better in that it reported based on device.
2. They don't answer their email. The automated response email doesn't count. The Pinch folks were really responsive.

So, I thought about this for a bit and came up with the criteria that I'm going to use as I go out and review different analytics companies. Basically, it comes down to the questions that I want to be able to answer from my analytics.

1. I want to localize my app. What languages do my customers speak? Country != language. Some of those nice Canadians prefer French. Flurry only reports sessions by region (Europe, NA, etc.) Not very useful for making a decision.

2. How many of my customers are trying to use an iPad? Are my customers primarily iPhone or iPod? What percentage are running new enough hardware that they will be able to take advantage of the new multi-tasking features in iPhone OS 4.0?

3a. What iPhone OS version are people running? If I need to move my app to 3.1, how many of my existing customers will I leave behind?

3b. Based on last week's stats, how many sales will I loose next week for moving to 3.1? As iPhone OS 4.0 is released, how quickly are my current customers and new customers moving to 4.0?

4. I realize that my apps are very small within the overall app store ecosystem. Do I get access to app store wide stats and trends towards the above questions?

5. Looking at the above metrics, compare user count to average session count. Is there a disparity somewhere? e.g. Do iPad users buy/install my app but not use it because they are frustrated with it for some reason? That would imply that I have a problem that I need to work on somewhere.

6. Does the event/action tracking system have an export function so that custom reports can be run on the events? I want to be aggregate the counts of some of my events and such.

7. Can I export my app's data and compare it to my Lite app's data? That would be very interesting.

Sunday, April 4, 2010

Thoughts on the iPad

The iPad was released yesterday. I've had a day to play with one and I have a few thoughts.

What is the iPad and what do you do with it?

iPhone owners, iPod Touch owners, and perhaps other smartphone owners will understand quite quickly what the iPad is. It is a large iPod Touch.

But more importantly, what does one do with an iPad? If you are one of the group of people I just mentioned, this will be pretty obvious. You use the iPad for all of the things that you use a smartphone for when you are home and your computer is on the other side of the room. The activities fall into two categories; quickly done and cheaply done.

Quickly done
- You are sitting on the couch watching a movie and you wonder what other movies an actor is in? There is an IMDB app for that.
- You wonder what movies are playing at the local theater. I like the Flixster app for that.
- You want to post something quickly to Facebook. There is a Facebook app.
- You want to check the score for the latest game. There is an ESPN scorecenter app.
- You want to check how the stock market did today. There are many apps for that.
- You want to see if the weather will be nice tomorrow. There are apps for that.
- You want to check if you have received that email you were expecting. The Mail app can do that.
- You have a feeling that there is a 9am meeting tomorrow and want to check your calendar. There is a Calendar app for that.
- You remember something that needs to be done tomorrow and want to put it on your to do list. There are many ToDo apps for that.

All of these things are quickly and easily done on an iPad. What, you don't have an app for that yet? No problem. The app store app lets you find a good app in just a couple of minutes. And this leads me to my next point.

Easily done

Let's say that I want to play a quick game as a diversion. Nothing so time consuming as the latest entry in the Halo or Super Mario Brothers franchise, but something simple and fun. Think Tetris, Solitare, or just about any arcade game from the 80's. The App Store delivers that.

I can virtually browse the isles and find something fun to do for just a few dollars. Not a game person? The iPad has books. Lots of them. Some of them for free. Want to spend some time getting the news? There are a lot of good apps for that in a format that is even better than the iPhone.

This is what the iPad is all about. Quickly and easily done.