IME, it sucks.
Okay, maybe not. The first time I used it, it was way off - maybe ±30º. I just tried it again and it seems to be right on. Maybe they fixed it in a software update.
I would sure like to make sure it works more reliably before using it in the plane though.
Think about the tech in the phone for a sec. There's accelerometers, and a telco-network assisted GPS chipset. AFAIK there is no magnetic compass inside the iPhone. But I could be wrong. Easy to check... grab a magnet... get it close enough to have an effect, but don't fry the phone in the process.
Anyway... with the above assumptions, the iPhone needs *motion* for the GPS to register a direction and speed to the overlying software. (Actually the GPS just spits out a continuous stream of location, but I believe the Apple API internally does the math and will hand any App written to the API the direction and speed, all calculated.)
Most "Compass" Apps on iPhone merge the GPS data and the accelerometer data themselves. (I don't believe this is in the API, but I'd have to go research... I stopped looking at the Apple API's in iOS 3 days, 'cause I just didn't have time to code up what I wanted to code for the gadget.) Some do a sane job of it, some won't.
Mostly what I've seen is when the GPS data is showing little motion, the accelerometer is very heavily weighted in the math... for the person standing in one spot and "spinning around". If the phone had motion in a particular direction prior to the stopping and spinning, it's not bad. If you start at a dead standstill and spin around, where the "compass" will point is anyone's best guess. It's usually wrong.
In flight/vehicles it seems to weight the GPS data more heavily (appropriately) and the compass heading is accurate. Well... if you wanted true headings. (Of course, an App could offer a choice here... true or magnetic. Actually haven't seen one yet that does, but have only tried four and a couple of "dashboards".)
In general, it's just not a very good way to do it. But it kinda works well enough to fool most folks that it's accurate.
Additionally for pilots, the "assisted" part of all of this means that at high altitude, if the GPS chipset has to perform a warm start, or worse... a cold start... and needs help from the cell towers for finding an initial location... the compass is going to be quite wacky. Hopefully the API sends a warning that the GPS data is bad, but what do you bet most compass apps "coast" using only the accelerometer data when the GPS signal is unusable and flagged so in the datastream from the API? I bet lots.
To really get to the bottom of this, you'd need the API source code or definitions document, the source of the specific Compass App, and a really good Objective C code reader. Maybe not even a coder, just someone who could be really detailed in documentation of all the failure modes, and what the phone is actually using for input data at any one time.
Bonus points for someone who writes an App that shares the status of all the inputs as data points in the corners of the screen, calculates an "accuracy score" (arbitrary, but it's better than nothing) and then publishes real-world test data for accuracy against known headings.
Probably not going to get that level of software development for $0.99 a copy, unless someone's passionate enough about their Compass App that they add all of that over time, for free.